I have been trying to create customized search for my plugin. I want it to search either by title, description, or username.
For example:
//inside my search function
function customized_search($search_query) {
$options = [
'type' => 'object',
'subtype' => 'my_subtype',
];
$options['joins'] = ["JOIN metadata met ON met.entity_guid = e.guid"];
$options['wheres'] = ["met.value LIKE '%$search_query%'"];
return elgg_list_entities($options);
}
This function works when searching by 'title' or 'description' but not by username. How can I make 'searching by username' to work?
Thanks!
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.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- seri_ng@seri_ng
seri_ng - 0 likes
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- seri_ng@seri_ng
seri_ng - 0 likes
You must log in to post replies.You are searching in objects but not in users.
I wanted the search result to return only a list of object entities not user. For example. in the blog page, I want to list blog posts of a specific user by using a username as the search query.
Is the username a value in metadata of your subtype?
yes, it is.