Tagged: member directory filter jquery
Hey there,
I am in need to find a way to filter users from the directory. I already have filters in action with a dropdown which is working fine. But I need to find a way to filter them with jQuery.
I develop a category screen before showing users which then will get filtered by, in my case, categories.
I have already tried to just select the option from the dropdown to filter them but it looks like that’s not enough. I also found out that there is a cookie set to change it but even after changing the cookie value it’s not working.
Would be great if you could help me figure out a way to filter users via jQuery so I can use an onClick event.
Thank you for your time and effort.
All the best,
– Mike from Nushara
So what I have found out so far is it would be something like this:
$.ajax({ type: "post", dataType: "json", url: "/wp-admin/admin-ajax.php", data: { cookie: 'bp-members-filter%3D<?= $var ?>%26bp-members-scope%3Dall', action: 'members_filter', object: 'members', filter: '<?= $var ?>', user_id: user_id, scope: 'all', page: '1', search_terms: '', template: '', exclude: false}, success: function(data) { } });
But it is of course not working. I just thought it would be helpful to make it easier.
Hi Mike,
Thank you for the question.You should be able to achieve it fairly easily.
May I suggest you to take a look at
bp_filter_request()
in the buddypress/bp-templates/bp-legacy/js/buddypress.jsThat should give you the proper idea(You need to use the current cookie etc).
Regards
BrajeshHi Mike,
You are welcome.
Have a great day to you too!
Regards
Brajesh
The topic ‘ [Resolved] Filter Directory users via jQuery’ is closed to new replies.