Opened 6 years ago
Last modified 6 years ago
#7742 new defect (bug)
bp_has_members( bp_ajax_querystring( 'members' )
Reported by: | Venutius | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Contributions | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | needs-codex |
Cc: |
Description
Looking at the documentation here:
https://codex.buddypress.org/developer/loops-reference/the-members-loop/
It does not actually say how you would apply the arguments to this string.
The forum posts show you need to use &, so:
`bp_has_members( bp_ajax_querystring( 'members' ) . '&per_page=20&type=alphabetical' ));'
Will return the members loop as alphabetical and with 20 members per page.
however,
bp_has_members( bp_ajax_querystring( 'members' ) . '&type=alphabetical' ));'
Does not produce an alphabetical list, in order to get that to work you need to remove the &
.
'&exclude=3'
seems to have no affect at all.
Am I using this incorrectly? (since others seem to be able to get this to work, in the past though I have a forum post with another user having the same problem).
Either way I think it needs to be looked at, and the documentation updated to explain the usage of the filter options, just so novices aren't looking all over for a code snippet that actually works for them.
The correct method is to filter
'bp_ajax_querystring'
to modify the arguments due to how thebp_ajax_querystring()
function sets the parameters in the members loop:https://buddypress.trac.wordpress.org/browser/tags/2.9.4/src/bp-core/bp-core-template.php?marks=1266#L1249
When using the filter, be sure to do checks against the
$object
so you are filtering against the members loop and not another loop.