Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add featured members into list


  • dqueens
    Participant

    @dqueens

    Hello guys,

    Thanks for your awesome plugin!

    I’m trying to create a new list of featured members based on wp role (each member will have the “featured” role assigned) and then include it at the top of /members/ page.

    I already searched for similar topics but couldn’t find anything useful. Also I’ve read the Members Loop Codex but I couldn’t understand the content at all as I’m not too familiar with PHP.

    I’d really appreciate a helping hand. Thank you!

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

  • Venutius
    Moderator

    @venutius

    Hi there,

    Have you tried https://wordpress.org/plugins/bp-featured-members/ ? Seems a lot easier than trying to write your own plugin.


    dqueens
    Participant

    @dqueens

    Hello Venutius,

    I already tried the plugin but it creates a new section named “Featured Members” instead of displaying users at the top of the list.

    Thanks anyway!


    Venutius
    Moderator

    @venutius

    Have you thought about acting BuddyDev if they can add this as a feature? I forked this and created BP Featured Groups, and as part of this I added a function to display the featured groups in a banner on the first page of the group list, which is similar to what you are looking for.


    dqueens
    Participant

    @dqueens

    Thanks for your reply, Venutius.

    I though about using the following BP Featured Members’ shortcode to display the list in the header: <?php echo do_shortcode(“[bp-featured-members]”); ?>

    Any idea on how to succesfully integrate it in the members-loop file?


    Venutius
    Moderator

    @venutius

    The issue is that the function used to display the members list does not check for user roles, so you’d have a bit of coding to work around that. It can search on user meta and that’s exacty what BP Featured Members does to create the featured members list so in the end you would create something very similar to that plugin. It’s possible also possible to insert your own content at the top of the Activity page but again you’ll end up writing a plugin to do that.


    dqueens
    Participant

    @dqueens

    I really appreciate your explanations.

    It’s not necessary for me to use roles as long as I can manage all the users being displayed. (add & delete)

    I can do it with the plugin (using user meta) but still can’t find out where exactly to place the shortcode in order to get my list displayed at the top of the Members page.


    Venutius
    Moderator

    @venutius

    What I’ve been playing with is this placed in your child themes functions.php-

    function bpex_execute_shortcode() {
    	
    	if ( class_exists( 'BP_Featured_Members' ) ) {
    		echo do_shortcode( '[bp-featured-members]' );
    	}
    }
    
    add_action( 'bp_before_members_loop', 'bpex_execute_shortcode' );

    But it’s not working. I’m sure you should be able to do aomething like that


    Venutius
    Moderator

    @venutius

    Found the problem, the above code should give you something to play with.


    dqueens
    Participant

    @dqueens

    Thank you for the code! It displays the list on 1 column.

    What CSS should I apply in order to have it in 3 columns and multiple rows? (same as bp members list)


    Venutius
    Moderator

    @venutius

    The usual CSS to change the members-list is as follows:

    #buddypress #members-list li {
    overflow: auto;
    list-style: none;
    float: left;
    width: 30%;
    margin: 0 20px 28px 0;
    border: 0;
    }

    This might work but it depends on which option you are using for the list.

    Also, another option is to use BP Directory Views, this gives a better three column layout in that it avoids an uneven display of the three column view.


    dqueens
    Participant

    @dqueens

    Hello Venutius,

    I think you misunderstood.

    BP Members list is displayed correctly. The problem is for the BP Featured Members list at the top.

    Please take a look at the following screenshot so you can see:

    View post on imgur.com

    I tried this CSS but it’s not working:

    .featured-members-list {overflow: auto;
    list-style: none;
    float: left;
    width: 30%;
    margin: 0 20px 28px 0;
    border: 0;}

    Also I tried to use one of the view strings (default) provided here but I don’t know exactly how to integrate it into the PHP code.


    Venutius
    Moderator

    @venutius

    No I didn’t, according to bp featured members when it uses the default list setting it uses the same CSS as the members list, so that’s the css I suggested.


    Venutius
    Moderator

    @venutius

    Hi there,

    What I was getting at earlier is that there’s a shortcode setting = view=”default” which should use the same css as the theme default, however I’ve just checked and in this context the only setting that seems to work is the default list view, so yes you are left having to undo the list css and turn it into a three column view.

    I tried this which gave me a three column view, but not one that matched the one produced by nouveau:

    .featured-members-list li {
        overflow: auto;
        list-style: none;
        float: left;
        width: 30%;
        margin: 0 20px 28px 0;
        border: 0;
    }

    Been looking in BuddyPress to see what CSS makes up the members list when it’s in three column mode but not found much so far.


    dqueens
    Participant

    @dqueens

    Thank you for all your help!


    Steve Harris
    Participant

    @steveharis22

    o create new user roles you can use Members plugin, it is a very popular user and role management plugin that was created to make WordPress a more powerful CMS.

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