BP Profile Search › Random sort
-
AuthorPost
-
LOIC
GuestHi,
Is it possible to randomly sort results ?
With this kind of shortcode for exemple (gwangi theme/ swap page) : [bps_directory template=”members/index-swap” order_by=”random”]Best regards !
andrea
Plugin AuthorHi LOIC,
That’s a nice feature, it’s not available yet but I’m adding it to my to-do list. Thank you!
Dominik
GuestHello Andrea,
i’m very intrested in that function too.
Would be awesome to get a result page with random users. (Need it form my members swap.) Glat to hear from you.Cheers
Dominikandrea
Plugin AuthorHello Dominik,
I still have that feature in my to-do list, but I moved it to low priority because I found it difficult to implement correctly. I’m sorry I’m not able to help!
David
Guest“I moved it to low priority because I found it difficult to implement correctly”
Man, please…
You have to implement this POWER feature 🙂
It will be really usefull.
andrea
Plugin AuthorHi all,
A simple solution could be to add this code to your bp-custom.php file:
add_filter ('bp_user_query_uid_clauses', 'random_order', 10, 2); function random_order ($sql, $object) { $request = bps_get_request ('search'); if (count ($request) > 1) $sql['orderby'] = 'ORDER BY rand()'; return $sql; }Please let me know if it works for you!
BeeNC
GuestThanks I will try it.
Do you think that it would be possible to filter only profiles with picture / avatar ?Have a nice day
Loïcandrea
Plugin AuthorHi Loïc,
Right now it’s not possible, it’s another thing on my to-do list.
BeeNC
GuestCan we make it work within function.php file ?
What is the parameter of the shortcode we have to add ?andrea
Plugin AuthorHi Loïc,
You mean the code in #10315? Yes, it works in functions.php too.
The same feature is not available with shortcodes though.
BeeNC
GuestThanks for your answer.
Unfortunately, I can’t make it work…andrea
Plugin AuthorHi Loïc,
If you wish, I can take a look at your test site. I’ll need a WP admin access, and you can share it privately using my Contact page.
-
AuthorPost