You’d need to pass an argument to bp_has_members in the members-loop.php file:
$args = array(
type => 'alphabetical'
)
if ( bp_has_members( $args ) ) :
endif:
So you would work out which BP theme you are using, then overload the correct members-loop.php for that theme and add the args as above.
Many thank yous for the reply! Would this be a function I would pop into functions. php — trying to understand if this would live there or where it should be placed.
I’m using the latest version of Buddypress and Nouveau to hook into a custom theme we’re using.
This is the top portion of my members-loop.php override for reference:
<?php do_action( ‘bp_before_members_loop’ ) ?>
<?php
if ( bp_ajax_querystring( 'members' ) =="") {
$queryString = "type=alphabetical&action=alphabetical&page=1";
} else {
$queryString = bp_ajax_querystring( 'members' );
}
?>
bp_nouveau_before_loop(); ?>
<?php if ( bp_get_current_member_type() ) : ?>
<p class="current-member-type"><?php bp_current_member_type_message(); ?></p>
<?php endif; ?>
<?php if ( bp_has_members( bp_ajax_querystring( 'members' ). '&type=alphabetical' ) ) : ?>
<?php bp_nouveau_pagination( 'top' ); ?>
<ul id="members-list" class="<?php bp_nouveau_loop_classes(); ?>">
…
@Venutius, are there specific instructions on how this might be accomplished — I was wondering where I’d insert this code into members-loop.php — any help is appreciated!
Sorry I thought you had it sorted since the code you supplied has the right option:
<?php if ( bp_has_members( bp_ajax_querystring( 'members' ). '&type=alphabetical' ) ) : ?>
IS this not working for you? works fine on my system.
@Venutius or it could be conflicting with my theme — do you know of any plugins that might accomplish this — premium or otherwise, as an alternate way to solve?
If your theme is overloading that page then yes the changes you make might not have any effect. Your best bet is to contact the theme author and see if that’s the case then ask them how to overload that.
@Venutius Just to make sure I have everything accounted for, I wanted to conifrm this should be the correct placement of members-loop.php — see screenshot for directory structure.
https://www.dropbox.com/s/cc6bqqrcxtvljmm/theme-override-placement.png?dl=0
Yep that looks right to me
Hmmm… The OP was for default alphabetical listings for group members.
In that case, rather than the members-loop
template, the template to overload is this ( assuming you are using the Legacy template pack ):
buddypress/bp-templates/bp-legacy/buddypress/groups/single/members.php
And the change would be:
<?php if ( bp_group_has_members( bp_ajax_querystring( 'group_members' ) . '&type=alphabetical' ) ) : ?>
So try overloading that template and make sure you adjust the placement of that template in your child theme.
@Venutius @shanebp If you’re using bp-nouveau, the code there for …single/members.php is different — I’m using that rather than legacy — is there a different location to add this?
Looks like that would be buddypress/groups/single/members-loop.php.
this line:
<?php if ( bp_group_has_members( bp_ajax_querystring( 'group_members' ) ) ) : ?>
Would be the one to change:
<?php if ( bp_group_has_members( bp_ajax_querystring( 'group_members' ) . '&type=alphabetical' ) ) : ?>
Hopefully that should work
Ach. Just made that edit now but sadly no luck — it’s persnickety on staying with newest:
https://familytravel.org/groups/fta-media-members/members/
That’s strange, I’ve just tested it an it works for me.
@Venutius Believe me, I know it should work and certainly wish it was 🙂 — wondering if perhaps there’s some ajax conflict with another plugin. My next step would likely be to turn off plugins to see where a conflict might arise.
Many thank yous to you and @shanebp for looking into this!
Hi, does this work for the nouveau theme? I cant find the same code under the nouveau folder. Thanks!