10, 'order_by' => 'points', 'order' => 'DESC' ], $atts ); extract( $options ); $output = ""; $pointsusers = GDK_Points::get_users(); if ( sizeof( $pointsusers )>0 ) { foreach ( $pointsusers as $pointsuser ) { $total = GDK_Points::get_user_total_points( $pointsuser ); $output .='
No users
'; } return $output; } public static function points_user_points ( $atts, $content = null ) { $output = ""; $options = shortcode_atts(['id' => ""], $atts ); extract( $options ); if ( $id == "" ) { $id = get_current_user_id(); } if ( $id !== 0 ) { $points = GDK_Points::get_user_total_points( $id, 'accepted' ); $output .= $points; } return $output; } /*付费可见短代码开始*/ public static function pay($atts, $content = null) { global $wpdb; $user_id = get_current_user_id(); $description = get_the_ID(); $result = $wpdb->get_row("SELECT description FROM " . GDK_Points_Database::points_get_table("users") . " WHERE user_id=" . $user_id . " AND description=" . $description . " AND status='accepted' LIMIT 0, 3;", ARRAY_A )['description']; //验证是否支付 extract(shortcode_atts(['point' => "10"], $atts)); $notice = ''; $pay_content = get_post_meta($description, 'pay_content', true); if (!empty($pay_content) && $pay_content != $content) { update_post_meta($description, 'pay_content', $content, true); } else { add_post_meta($description, 'pay_content', $content, true); } if (is_user_logged_in()) { if ($result == $description || current_user_can('administrator')) { $notice.= '本段内容需要支付 ' . $point . '金币查看
'; $notice.= '您当前拥有 ' . GDK_Points::get_user_total_points($user_id, 'accepted') . ' 金币,您的金币不足,请充值
'; $notice.= ''; $notice.= '本段内容需要付费查看,您当前拥有 ' . GDK_Points::get_user_total_points($user_id, 'accepted') . ' 金币
'; $notice.= ''; $notice.= '查看本段内容需要支付 ' . $point . ' 金币
'; $notice.= '您尚未登录,请 ' . $login_uri . ' 或者 立即注册
'; $notice.= '日期时间' . ' | 金币 | ' . '类别 | ' . '状态 | ' . $desc_th . '' . $point->description . ' | '; } if($point->points > 0){ $leibie = '充值';}elseif($point->points < 0){$leibie = '消费';} $output .= '
---|---|---|---|
' . $point->datetime . ' | ' . '' . $point->points . ' | ' . '' . $leibie . ' | ' . '' . $point->status . ' | ' . $desc_td . '