@stagger-lee
8 years ago
Yes, I see now it is RC2 version of PHP. Get lost, why I am using it. Stable version is 7.0.1, that tricked me.
Anyway it is here if you want to take a look. It is waiting for you anyway.
9 years, 9 months ago
add_action( 'bp_before_member_header_meta', 'devb_show_role_on_profile'); function devb_show_role_on_profile(){ global $wp_roles; $user_id = bp_displayed_user_id(); $user = get_userdata( $user_id ); $roles = $user->roles; if( !$roles) return ; if ( !isset( $wp_roles ) ) $wp_roles = new WP_Roles(); $named_roles = array(); foreach( $roles as $role ){ $named_roles [] = $wp_roles->role_names[$role]; } if( $named_roles ) echo '<span class="user-role activity">'. join( ', ', $named_roles ) . '</span>'; }
Showing User role on BuddyPress Profile