Skip to:
Content
Pages
Categories
Search
Top
Bottom

Tried everything on this topic: can’t get Alphabetical default to work


  • mocreate
    Participant

    @mocreate

    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!

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

  • Venutius
    Moderator

    @venutius

    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.


    mocreate
    Participant

    @mocreate

    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.


    mocreate
    Participant

    @mocreate

    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(); ?>">


    mocreate
    Participant

    @mocreate

    @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!


    Venutius
    Moderator

    @venutius

    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
    Moderator

    @venutius


    mocreate
    Participant

    @mocreate

    @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?


    Venutius
    Moderator

    @venutius

    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.


    mocreate
    Participant

    @mocreate

    @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


    Venutius
    Moderator

    @venutius

    Yep that looks right to me


    shanebp
    Moderator

    @shanebp

    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
    Moderator

    @venutius

    Drat, sorry, my error


    mocreate
    Participant

    @mocreate

    @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?


    Venutius
    Moderator

    @venutius

    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


    mocreate
    Participant

    @mocreate

    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/


    Venutius
    Moderator

    @venutius

    That’s strange, I’ve just tested it an it works for me.


    mocreate
    Participant

    @mocreate

    @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!


    shaundot
    Participant

    @shaundot

    Hi, does this work for the nouveau theme? I cant find the same code under the nouveau folder. Thanks!

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