Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Adjust BP Members Directory
- * Insert myCRED details into the BP Members Directory loop.
- * @version 1.0
- */
- add_action( 'bp_directory_members_item', 'mycred_details_in_bp_members_loop' );
- function mycred_details_in_bp_members_loop() {
- if ( ! function_exists( 'mycred' ) ) return;
- global $members_template;
- $user_id = $members_template->member->id;
- $mycred = mycred();
- if ( $mycred->exclude_user( $user_id ) ) return;
- // Example: Show balance
- $balance = $mycred->get_users_balance( $user_id );
- echo '<div class="mycred-user-balance">' . $mycred->format_creds( $balance ) . '</div>';
- // Example: Show Users Rank
- if ( function_exists( 'mycred_get_users_rank' ) ) {
- echo '<div class="mycred-user-balance">' . mycred_get_users_rank( $user_id ) . '</div>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement