what i required is ??
for example i have metadata called collegename .......
i create a input box for search ..... in tat i dont know how to write a sql query %like % in the elgg_get_entities..
i check all the documentation but i am not getting any solution ....
can u suggest ur solutions . so tat i can develope.....
http://reference.elgg.org/entities_8php.html#af085c8362e49c4f52d4f1fcf58ca6fb8
but dont know how to write it exactly and display it .....
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.
thanks guys i finally found out a solution for it ........... i will paste it below .......
using this i can search a single profile field but i want to search more means wat condition to write can any one tell me @iionly
'metadata_names' => array('collegename', 'rollnumber', 'etc', 'etc')
satheesh pm ...... i think ur answer s for same input box .........i have different input box . wat to do for tat
I'm not sure what you exactly want to achieve.
If you want to get the users who have the search term in any of the metadata fields to be searched on it should work like Satheesh PM suggested, i.e. to provide all metadata_names in an array for the elgg_get_entities_from_metadata() call.
But if you want to have separate searches for separate metadata (search box 1 retrieving only users who have the search term in their collegename profile field, search box 2 retrieving only users who have the search term in their city profile field etc.), you have to use a separate elgg_get_entities_from_metadata() call for each separate search box with only the single metadata (profile field) to be searched on.
@iionly i used to elgg_get_entites_from_metadata() in a single form action ........ but only one works another one is not working ........ i dont know why .............
first search option for collegename:
$query = $_POST['colleg'];// colleg is id of the input box
//$limit = '20'; // if you want all set it to false, otherwise to a number
//$offset = '0'; // a number or 0
//$users = elgg_get_entities(array('type' => 'user', 'limit' => $limit, 'offset' => $offset));
$users = elgg_get_entities_from_metadata(array(
'type' => 'user',
'metadata_names' => 'collegename',
'limit' => '10',
'metadata_name_value_pairs' => array('name' => 'collegename', 'value' => '%'.$query.'%', 'operand' => 'LIKE'),
));
second search option for city as u said.
$query = $_POST['postal'];// colleg is id of the input box
$users = elgg_get_entities_from_metadata(array(
'type' => 'user',
'metadata_names' => 'postalcode',
'limit' => '10',
'metadata_name_value_pairs' => array('name' => 'postalcode', 'value' => '%'.$query.'%', 'operand' => 'LIKE'),
));
can u tell me is this code is right or not??
Please try this.
$users = elgg_get_entities_from_metadata(array(
'type' => 'user',
'metadata_names' => 'postalcode',
'metadata_value' = >' '%'.$query.'%',
'limit' => '10',
));
thanks guys for ur help finally i corrected it ..... i just changed the inputbox name correctly i have done a mistake there and correct coding is
guys better use !empty()
instead of isset()
thnks for help dude
- Previous
- 1
- 2
- Next
You must log in to post replies.