Hello,
I have a custom user meta field which is a staff label field. For people with “staff” capability, they can go to their profile in WP admin and enter some text for a label such as “Lead Developer, Writer, Support, etc. I would like to output this label on BBPress profile but cannot figure out how to do it. I am using the currently displayed profile ID. In the following file:
/wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/members/single/members-header.php
I know it’s bad to hack core files, I will move to my themes folder once it’s working. This is the code I have currently.
<?php
$member_id = bp_displayed_user_id();
if ( user_can( $member_id, 'staff' ) ) {
if ( get_the_author_meta( 'staff') ) {
$x = ( get_the_author_meta( 'staff', $member_id ) == '' ) ? "Staff" : get_the_author_meta( 'staff', $member_id );
echo '<div class="staff-label">';
echo $x ;
echo '</div>';
}
} ?>
This code is working fine in the comments area with different logic to grab the user ID, just not working for BuddyPress. Any suggestions?
Thanks. 🙂