Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_shortcode( 'mycred_buy_points_link', 'mycred_render_buy_points_link' );
- function mycred_render_buy_points_link( $atts ) {
- if ( ! is_user_logged_in() || ! function_exists( 'mycred' ) ) return '';
- $atts = shortcode_atts( array(
- 'ctype' => 'mycred_default',
- 'balance' => 1,
- 'title' => 'Buy More Points',
- 'url' => ''
- ), $atts );
- // Prep
- $cui = get_current_user_id();
- $mycred = mycred( $atts['ctype'] );
- // Check if current user is excluded
- if ( $mycred->exclude_user( $cui ) ) return '';
- // If users balance is too low, show the url
- if ( $mycred->get_users_balance( $cui, $atts['ctype'] ) < $atts['balance'] )
- return '<a href="' . $atts['url'] . '">' . $atts['title'] . '</a>';
- return '';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement