Skip to:

buddypress user roles different colours

  • planetoffitness


    Hello, i need a way of showing that certain users on my buddypress site have certain roles.

    I need to show that admins are “official (red)”, and some accounts with a different user role, for exemple editors, are “official fitnesscenters (green)”, and all the others, the normal subscribers remain as they are (black).

    Any ideas how i can do that?


Viewing 6 replies - 1 through 6 (of 6 total)

  • planetoffitness


    any ideas?






    Hey there,

    I’m no expert, just a buddypress user like you, but you should precise what you want to change and where, for people to understand and help you.
    What element should have a different color? And where? On the members directory? In profiles?everywhere? etc
    Good luck

    If you inspect the generated markup you will see that the loop list elements will have a members type class rendered if user has a type you can then use those to effect styling on.

    In the member single screens it’s a little trickier you do have the ability to use the template hierarchy to set a template for a user type (please refer to the codex for instruction) otherwise for the moment you would need to modify the home.php template to add this yourself something like:

    <?php $user_type = bp_get_member_type( bp_displayed_user_id() ); ?>
    <div id="buddypress" class="<?php echo esc_attr( $user_type ); ?>">

    First line is an addition the second you need to modify the existing element to add the class and php – all in a child copy of the home.php template naturally.
    We will update buddpress core to add a class to the body elements for 2.8 as this would be useful and styling could be effected on that too so if you would rather wait for 2.8…



    Hey guys!

    @kida18 thanks for your hint 🙂 i will remember the next time!

    @hnla thanks for your response. Uff, this sounds really complicated for me, im not a really good coder! 😉 So i think, i’ll wait for your update.

    What i want: i need different name colours of the profiles. For exemple admins red, subscriber black, fitnesscenters green. (for this is can give the fitnesscenters another user role for exemple editor)
    The name colour should be everywhere, in the profile, in the member list, in the activity list, everywhere. (Much better whould be, if you just can give the users different colours in the user list in the dashboard, and i dont have to give them different user roles.) This would be very usefull and easy to handle, i think this feature would also be interesting fot other buddypress users here.
    Look at my screenshots, will this be enable in your update 2.8?

    How to edit exemple

    Member List exemple picture

    Thanks guys

    What your highlighting are really WP artifacts, Users / user Roles are handled / managed by WP styling the admin would be something outside BP’s control really, BP member loop directory could be styled but currently we don’t add WP user roles as classes to those list items (nor does WP ), also you would want to be careful about exposing certain roles i.e ‘admin’.

    BP core is updated so that member types are now added to the user screens so you’ll be able to style on those and /or you could add member types to match to certain user roles I guess and achieve frontend BP styling that way.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar