<?php /* Template Name: Purchase Point*/ ?> <?php if(is_user_logged_in()) { if ($_SERVER["REQUEST_METHOD"] == "POST") { $purcahse_user_id = trim($_POST['purcahse_id_val']); if (empty($purcahse_user_id)) { echo "输入的ID为空!!!"; } else { $purcahse_user_balance = mycred_get_users_balance( $purcahse_user_id ); if($purcahse_user_balance <100) { echo "该用户积分不足!!!"; } else { mycred_subtract( 'penalty', $purcahse_user_id, -100, '积分消费' ); echo "用户ID:".$purcahse_user_id.",成功消费100基本!"; } } } } else { echo "请先登录!"; } ?>