Hi there,
Have you tried https://wordpress.org/plugins/bp-featured-members/ ? Seems a lot easier than trying to write your own plugin.
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!
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.
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?
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.
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.
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
Found the problem, the above code should give you something to play with.
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)
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.
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.
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.
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.
Thank you for all your help!
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.