This topic has 10 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #166990
     vidjaylee
    Participant

    hi,

    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

    #167039
     Laura
    Moderator

    Hello, 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 solution

    Laura 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 🙂

    #167044
     vidjaylee
    Participant

    How I do that?
    ?

    #167207
     Radu
    Moderator

    Hi,

    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 solution
    #167360
     vidjaylee
    Participant

    See the 2 illustrations to understund
    the first member type

    the 2nd member type

    in this image you can see my 2 member type, And each member type has his own color in avatar.

    #167361
     vidjaylee
    Participant

    i would like to add this class in the member directory

    #167702
     Radu
    Moderator

    I 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 solution
    #167703
     vidjaylee
    Participant

    it’s work in the member profil but not in the member directory

    #167832
     Radu
    Moderator

    Hi,

    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
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #168025
     vidjaylee
    Participant

    great, that’s work
    thank you

    #168097
     Radu
    Moderator

    Hi,

    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
Viewing 11 posts - 1 through 11 (of 11 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?