Skip to content

Instantly share code, notes, and snippets.

@JudeRosario
Created July 13, 2016 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JudeRosario/a3babb91cb3d9a0f36c809c8ab11c91f to your computer and use it in GitHub Desktop.
Save JudeRosario/a3babb91cb3d9a0f36c809c8ab11c91f to your computer and use it in GitHub Desktop.
Apply CSS to users avatars by role
<?
add_filter('bp_member_avatar', 'bp_role_in_class');
function bp_role_in_class( $args ) {
global $members_template ;
$user = new WP_User( $members_template->member->id );
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
$args['class'] .= " " . $role;
}
return $args;
}
@craigtommola
Copy link

Please update this to reflect Panos' snippet in this thread: https://premium.wpmudev.org/forums/topic/buddypress-apply-css-to-users-avatars-by-role

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment