[buddypress-trac] [BuddyPress Trac] #5455: bp_ajax_querystring to filter members by role?
buddypress-trac
noreply at wordpress.org
Wed Mar 12 19:14:28 UTC 2014
#5455: bp_ajax_querystring to filter members by role?
-------------------------+------------------------------
Reporter: landwire | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Members | Version: 1.9.2
Severity: normal | Resolution:
Keywords: |
-------------------------+------------------------------
Comment (by boonebgorges):
landwire - I tried posting this to the buddypress.org thread, but I seem
to be getting blocked by a mod_security rule or something. Anyway:
> is_page does not work in ajax call.
I'd recommend working around it by looking at `$SERVER[ 'HTTP_REFERER'] `.
During an AJAX request, it'll show the URL of the page that the AJAX
request came from. A complete solution would then look something like
this:
{{{
function bbg_filter_querystring( $q ) {
// Break up the query string into the $query_args array
parse_str( $q, $query_args );
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
$current_url = $SERVER['HTTP_REFERER'];
// Do magic to determine whether you're on 'office' or whatever
if ( false !== strpos( 'office', $current_url ) ) {
$page_type = 'office';
}
} else {
if ( is_page( 'office' ) ) {
$page_type = 'office';
}
}
// continue to query members
}
add_filter( 'bp_ajax_querystring', 'bbg_filter_querystring', 20 ); // Use
a high priority so you don't stomp on BP
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5455#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list