Hi guys, I'm sorry for this, but I searched everything by now, and all I can find is some old outdated info about this and plugins who used to work, but don't work anymore in 1.8
I need a form where users can filter members and search for them.
Looking at the search hooks, and the info I found, it looks to me as not such a big work, but I just don't know where to start.
this works for instance:
http://mysite.com/search?q=testword&entity_type=user&search_type=entities
This displays all the users with 'testword' in their profile.
What I would like to see is:
http://mysite.com/search?profilefield1=testword&profilefield2=anotherword&entity_type=user&search_type=entities
I don't need a fancy plugin with a userinterface, I can make the form myself, but I just need to know how I can start making the search ready to to search specific profilefields with specific values.
Anyone caring to help me out with this?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- Dries@driesdk
Dries - 0 likes
- NoobyNoob@nooby
NoobyNoob - 0 likes
- NoobyNoob@nooby
NoobyNoob - 0 likes
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- NoobyNoob@nooby
NoobyNoob - 0 likes
You must log in to post replies.Hm... maybe something like this: Register a handler for the 'search', 'user' hook. Inside the handler you can then do:
And build your own query:
...or actually I suppose you should add each individual field only IF user has entered them:
Thanks a lot, I'll try to figure something out :)
@juho.jaakkola how would you suggest to add some extra strings inside the $name_value_pairs code you posted? For example some fields need operand to be > or <. I have field that needs to find value larger and/or smaller than value selected in the form dropdown field but other fields do not need specific operand.
Much appreciated.
Does anyone know if 1.8 supports 'operand'=>'>=', in elgg_list_entities_from_metadata($options) code?
I'm using "metadata_name_value_pairs" and need to find metadata values equal to/larger than first input field value and smaller than/equal to second filed value. Basiaclly I have two fields and need to find metadata between two numbers (selected by these two fields).
Thanks.
Any valid sql operator should be possible
Thanks Matt, that helps.