BuddyDev

Search

[Resolved] Showing member profile type as icon in members directory

  • Participant
    Level: Initiated
    Posts: 3
    Henrik on #9199

    Hi i am using your great plugin with kleo theme, i would like to know if it’s possible to show member profile type as icon’s in members directory like gender, female = shows a dashicons as a female or males shows a male icon.

    thanks for the great plugin

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #9221

    Hi Henrik,
    Can you please confirm me if the Kleo theme uses font awesome ? If yes, I can post you the complete code to show the icon.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 3
    Henrik on #9222

    They use fontello, but dev says no problem inserting <link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css”&gt; in header.

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #9223

    Well, It is a bad idea to use font awesome for just 2 icons.
    Also, just confirming that that the member type names are “male” and “female” or please let me know the correct member type names(unique names).

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 3
    Henrik on #9224

    It could be .png images for all i care 🙂

    kleo_bp_profile_member_type_label

    k/members/type/mand

    /members/type/kvinder

    http://imgur.com/Xker6Wc

    http://imgur.com/06brYbr

    so unique name for ladies are = kvinde

    and unique names for men are = mand

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #9231

    Hi Henrik,
    Here is an example with font awesome. Please feel free to modify it and adapt with your own iconset.

    
    /**
     * Show Font awesome icon based on the member type
     */
    function buddydev_show_member_type_in_directory() {
    
    	$user_id = bp_get_member_user_id();
    	if ( ! $user_id ) {
    		return ;
    	}
    
    	$member_type = bp_get_member_type( $user_id, true );
    	$output = "";
    
    	if ( $member_type == 'kvinde' ) {
    		$output ='<i class="fa fa-venus" aria-hidden="true"></i>';
    	} elseif ( $member_type == 'mand' ) {
    		$output = '<i class="fa fa-mars" aria-hidden="true"></i>';
    	}
    
    	echo $output;
    }
    
    add_action( 'bp_directory_members_item', 'buddydev_show_member_type_in_directory' );
    
    

    Please put the code in bp-custom.php.
    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 3
    Henrik on #9232

    you are a superstar, thank you so much. now i just need to style it nice..

    Thanks mate..

    http://i.imgur.com/w8roGDL.jpg

  • Keymaster
    (BuddyDev Team)
    Posts: 24190
    Brajesh Singh on #9239

    Hi Henrik,
    That looks good.
    All the best 🙂

The topic ‘ [Resolved] Showing member profile type as icon in members directory’ is closed to new replies.

This topic is: resolved