-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.0.x bp-better-diretories #7
base: master
Are you sure you want to change the base?
Conversation
Results in cleaner URLs
@mecanographik
I'm assuming that the In order to refresh the member directory using AJAX, your PHP callback needs to load the templates. BP does it with a generic template loader: https://buddypress.trac.wordpress.org/browser/tags/2.6.1/src/bp-templates/bp-legacy/buddypress-functions.php#L748 Your filter on |
Hi @boonebgorges thanks for your answer.
Where do i pass the $query_string parameters to rebuild the query with some meta keys / meta values for example? Do i need to use the bp_dtheme_ajax_querystring function define in ajax.php ? Thanks for your answer |
I’m working with @mecanographik on this project. I follow your advices and here is what i can do : I load the template BuddyPress in my php callback and i can update the member directory using AJAX. Is it the best way to load the template and update the loop ?
my_ajax_test() returns an HTML string. I update the DOM with this string.
Thanks for your help ! |
Hi @vinylroads - Yes, something like this seems correct. The |
Glad to see it seems ok for you. I thought of an improvement : Previously, i have tested and call JS function
This function is really simple to use : It refreshes the member loop without the need to update the DOM in the Unfortunately, we can only send in I need to filter users with meta_value. So, in
So, i was wondering if it would be possible to modify the querystring here in order to pass meta_value (or anything else possible with querystring). |
I don't understand why you have this restriction.
I would think that something like the following would work: function my_bp_loop_querystring( $query_string, $object ) {
if ( ! empty( $query_string ) ) {
$query_string .= '&';
}
$query_string .= '&type=active&action=active&page=1';
if ( isset( $_POST['meta_key'] ) && isset( $_POST['meta_value'] ) ) {
$meta_key = wp_unslash( $_POST['meta_key'] );
$meta_value = wp_unslash( $_POST['meta_value'] );
$query_string .= '&meta_key=' . urlencode( $meta_key ) . '&meta_value=' . urlencode( $meta_value );
}
return $query_string;
} |
Thanks for the code. I think i know how to filter with meta_value because i already do it without ajax (with simple page refresh). I was just wondering if it was possible to use a built in function like Regards, Sébastien |
Thanks! Looking forward to seeing how it works out. On 10/17/2016 03:07 PM, vinylroads wrote:
|
Thanks so much @boonebgorges @imath @vinylroads , |
Hi @boonebgorges, Could you give me an advice on this ? I would like to filter the members loop with multiple meta_key and meta_value (because i have multiple selects in my form). for example :
Here is how i build my query. I’ve tested it with a simple native WordPress So, how can i pass this array to the buddypress querystring. Here is the code :
When i retrieve the datas sent by POST, i use array_push in order to build the array :
Then, i use
Here is a print of the final array with multiple meta_key and meta_value :
This array seems correct. But the query string is not filtered. If i add a
I can get all the members containing 'pierre' so i think that this is correct :
The query string is filtered. Do you think it’s possible to have multiple meta_key / meta_value with the buddyPress querystring ? (i know it’s possible with WordPress, already done that). Thank you for your help, regards ! |
Hi, Let me know when you have time if it’s possible to use nested arrays (complex queries / Multiple custom user fields handling) like as we can use with WordPress. Something like https://codex.wordpress.org/Class_Reference/WP_Meta_Query But otherwise, i found an easy solution which is ok. I would prefer to use nested array because i guess it’s cleaner. So, my solution : I get all the user ids :
I build a coma separated list :
(here, i could improve my code without a foreach and use something like Then, the querystring :
It works, i can filter members loop with different meta_key / meta_value ... yeah ! |
Hi @vinylroads - Thanks for the updates! It might be possible to build a complex meta_query parameter as part of the querystring. It'd have to look like this:
This would probably work, but it'd be quite clumsy. Your solution is probably just as good. In the future, it'd be nice if there were an easier way to intervene in |
Hi @boonebgorges @imath - How are you? click on the yellow button "filtres" ... ;-) Regards, |
La page n'arrive pas à charger :(
…On 04/05/2017 07:01 AM, Pierre Dickinson wrote:
Hi @boonebgorges <https://github.com/boonebgorges> - How are you?
I want to thank you again for your precious help on this project, you
can check it out the buddypress acf ajax search demo we have built here :
https://v2.laplateforme.net/individus/
click on the yellow button "filtres" ... ;-)
Regards,
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAPDY-MZ1Sn2GbfDvStc9xH4nehmtgu7ks5rs4KFgaJpZM4KX1NR>.
|
Hello, could you try again ? We can can see the page, not sur why you can't... |
Hi Boone,
I'm wondering if i still can use your plugin, but i have been trying to simply update the Members Loop using Ajax on a "click" event on a link in the Members directory but i can't figure out what is wrong? the loop is not refreshed in ajax on click. please help ! here is my code :
and here is my js :
What's wrong? Please help me with this, it must be "simple" ;-)