Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_has_members – bp_ajax_querystring


  • charlcfc
    Member

    @charlcfc

    Hi All

    Got a page called members-functions.php and within that page running a function which does:

    if ( bp_has_members( 'type=alphabetical&include='.$user_id) ) :
    while ( bp_members() ) : bp_the_member(); ?>

    and some other jaz.

    This returns all the members, however a person cannot filter between the members such as: Last Active, Newest Registered.

    When i change it to if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : instead of if ( bp_has_members( 'type=alphabetical&include='.$user_id) ) : then the filtering works, but other custom functionalilty on the members are lost:

    Within members-loop.php we got some php which does:

    	$bp_ajax_string = bp_ajax_querystring( 'members' );
    
    if ( $includes == "") {
    if ( strpos($bp_ajax_string,"newest") != false ) { $bp_ajax_string = str_replace("newest","alphabetical",$bp_ajax_string); }
    if ( strpos($bp_ajax_string,"active") != false ) { $bp_ajax_string = str_replace("active","alphabetical",$bp_ajax_string); }
    
    }
    else {
    if ( strpos($bp_ajax_string,"newest") != false ) { $bp_ajax_string = str_replace("newest","active",$bp_ajax_string); }
    if ( strpos($bp_ajax_string,"alphabetical") != false ) { $bp_ajax_string = str_replace("alphabetical","active",$bp_ajax_string); }
    if ($bp_ajax_string == NULL) { $bp_ajax_string = 'type=active&action=active';	}
    }

    When i remove that code then the same still happens since i thought that must be conflicting, so somewhere else there must be ajax conflicting of some sort.
    Is there a better method to call a list of all the members instead of using: if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) :
    The orginal members-loop.php has been modified and none of the existing code is still within it since get called in that page.

    Any suggestions of what might cause ajax conflicting within buddypress will be most welcome or any other suggestions why a person cannot fileter between members.

    Thanks,
    Charl

Viewing 7 replies - 1 through 7 (of 7 total)
  • Have any solutions been made for this? I would like to have custom parameters such as “if ( bp_has_members( ‘type=alphabetical&include=’.$user_id) )” but then none of the searches work. Any way to either get searches to work with custom parameters, insert my custom parameters into bp_ajax_querystring(), or add another filter that is on all the time?

    I have WP 3.2.1/BP 1.5. I am using the BP-default theme.


    akingston47
    Participant

    @akingston47

    I’d really like to get this working again too. I had it it working fine until I upgraded to BP 1.5. I seem to be able to include a list of comma separated user ids but they will only display in the order the users registered beginning with the oldest member which is not what I want. I need to get it back to displaying the last active user. Any help would be much appreciated.

    I found a solution which works pretty well. You can pass parameters in addition to the bp_ajax_querystring. Here is my example:
    if ( bp_has_members(bp_ajax_querystring( 'members').'&type=alphabetical&exclude='.$value) ) : ?>

    The only problem is the parameter “include” does not work. This basically says only list these members and no others. That negates the bp_ajax_querystring() function so filters do not work. But you can use “exclude” as this only modifies the list returned by bp_ajax_querystring() and then filters work. As you can see from my example, you can also use type=alphabetical to automatically make the list alphabetical instead of by activity. Hopefully this helps someone.


    akingston47
    Participant

    @akingston47

    Thank you for that @gingram815 but I really find it so hard to believe that “include” no longer works. It really is killing my site. I know it might sound easy to just reverse the query and use “exclude” instead but the query I have is very complicated and it really is not so simple to find the members to exclude. Does anyone know if this will be fixed in the next release or know another way around it?


    Boone Gorges
    Keymaster

    @boonebgorges

    Can you be more specific about what you mean when you say that the include parameter doesn’t work? By design, the include parameter overrides all others.

    I’ll give it a test tomorrow if I remember, but in any case, it’ll never get fixed if there’s no Trac ticket. Trac.buddypress.org. Please provide all the details and steps to reproduce that you can.


    Arx Poetica
    Participant

    @arxpoetica

    It’s just not working, period. As far as I can tell.


    Arx Poetica
    Participant

    @arxpoetica

    Okay, Here’s what I get.

    if ( bp_has_members(bp_ajax_querystring( 'members')) ) :

    only returns one result.

    But

    if ( bp_has_members(bp_ajax_querystring( 'members').'&type=alphabetical') ) :

    returns them all…hmm…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘bp_has_members – bp_ajax_querystring’ is closed to new replies.
Skip to toolbar