Tried everything on this topic: can’t get Alphabetical default to work
-
All,
Hi! I’ve tried every remedy on Buddypress and other sites to get Alphabetical to be the default view at:
https://familytravel.org/groups/fta-media-members/members/
Still nothing. It’d be great if the URL would help the sort, but is there a plugin or something I’m missing to get this working? I’ve seen the help topics here, but they’re unfortunately not the solution for this.
Any help appreciated!
-
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.
this may have some relevance: https://buddypress.trac.wordpress.org/ticket/8050
@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-looptemplate, the template to overload is this ( assuming you are using the Legacy template pack ):
buddypress/bp-templates/bp-legacy/buddypress/groups/single/members.phpAnd 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.
Drat, sorry, my error
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.
Hi, does this work for the nouveau theme? I cant find the same code under the nouveau folder. Thanks!
- You must be logged in to reply to this topic.