Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Total Point Balances
- * Returns the total point balance amongst all users for a
- * specific point type.
- * @version 1.0
- */
- if ( ! function_exists( 'mycred_pro_all_points_shortcode' ) ) :
- function mycred_pro_all_points_shortcode( $atts ) {
- if ( ! function_exists( 'mycred' ) ) return 0;
- extract( shortcode_atts( array(
- 'type' => 'mycred_default'
- ), $atts ) );
- global $wpdb;
- if ( $type == '' )
- $type = 'mycred_default';
- $mycred = mycred( $type );
- $total = $wpdb->get_var( $wpdb->prepare( "SELECT SUM( meta_value ) FROM {$wpdb->usermeta} WHERE meta_key = %s", $type ) );
- if ( $total === NULL ) $total = 0;
- return $mycred->format_creds( $total );
- }
- endif;
- add_shortcode( 'mycred_total_points', 'mycred_pro_all_points_shortcode' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement