-
Author
-
July 11, 2017 at 01:47 #166990
vidjaylee
Participanthi,
buddydev.com developper give me that snippet to add a member type class in member profile
function buddydev_add_membertype_to_body_class( $classes = array() ) {
if ( ! bp_is_user() ) {
return $classes;
}
$member_types = bp_get_member_type( bp_displayed_user_id(), false );
if ( ! $member_types ) {
return $classes;
}
foreach ( $member_types as $member_type ) {
$classes[] = ‘member-type-‘ . $member_type; // member-type-student etc.
}
return $classes;
}
add_filter( ‘bp_get_the_body_class’, ‘buddydev_add_membertype_to_body_class’ );
how to add this class in member directory?
my idea is display each member type profil by color
July 11, 2017 at 18:05 #167039Laura
ModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! ?Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
July 12, 2017 at 19:59 #167207Radu
ModeratorHi,
I don’t fully understand what you need to acheive see the attached screenshot
This you want to acheive ?
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 13, 2017 at 23:48 #167360vidjaylee
ParticipantSee the 2 illustrations to understund
in this image you can see my 2 member type, And each member type has his own color in avatar.
July 13, 2017 at 23:51 #167361vidjaylee
Participanti would like to add this class in the member directory
July 17, 2017 at 17:44 #167702Radu
ModeratorI see you don’t need any snippet to adds that, it seems Kleo adds that already, I’ve tested with this plugin https://wordpress.org/plugins/bp-member-type-generator/ I’ve created a type named player
And then I’ve added this CSS
COPY CODE.member-type-player #item-header-avatar { background: red !important; }
And the border was colored
For additional member types colors just add a new rule like :
.member-type-student #item-header-avatar { background: yellow !important; }
The css will be added to wp-admin -> theme options -> General settings -> Quick CSS Cheers R.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 17, 2017 at 18:03 #167703vidjaylee
Participantit’s work in the member profil but not in the member directory
July 18, 2017 at 17:47 #167832Radu
ModeratorHi,
The snippet provided by that develooper cannot work on directory cuz adding a member type name to the body class it’s useless since the class should be added to the each memory box.
Just create a file named members-loop.php in /wp-content/themes/kleo/buddypress/members/ and paste the next content in it https://pastebin.com/raw/LvnMy818
CSS.
COPY CODE.directory.members .member-type-player .item-avatar { border-color: #00b9f7 !important; } .directory.members .member-type-manager .item-avatar { border-color: red !important; }
Cheers
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 20, 2017 at 20:02 #168097Radu
ModeratorHi,
You’re welcome.
Please leave a review + 5* on themeforest theme page please if you want
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.