Display specific role on profile user
- 
		Hello, I would like to display a badge instead the user role on the user profile. I tried many scripts but nothing seems to be good. add_action( 'bp_before_member_header_meta', 'role_on_profile' ); function 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 ( isset($named_roles[2]) ) echo '<span class="user-role activity">'.$named_roles[2].'</span>'; }// edited to use CODE button // here is the code but it is not working. 
Viewing 8 replies - 1 through 8 (of 8 total)
	
Viewing 8 replies - 1 through 8 (of 8 total)
	
- You must be logged in to reply to this topic.