Hi!
I'm using elgg 1.7, and I try to learn how to develope a plugin. I have a question again about the get_entities method.
I read the reference to understand the usage of this method, but something is not clear for me.
My piece of code:
// I get the user ID
$user_guid = get_loggedin_userid();
// ... and I try to select all object, with the subtype 'my_subtype', to the current loggedin user.
$q = get_entities(array('type '=>'object', 'subtype'=>'my_subtype', "owner_guids"=>$user_guid));
If I try print_r($q), then I get not just the elements with the subtype: my_subtype, but all elements with the type: object.
What should I do to get from the database what I want?
Thanks for any help!
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.
- János@horvathjanos
János - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- János@horvathjanos
János - 0 likes
You must log in to post replies.I found the solution to my problem! :)
$params = array(
'types' => 'object',
'subtypes' => 'my_subtype',
'owner_guid' => $user_guid,
'limit' => 100
);
$q = elgg_get_entities_from_metadata($params);
the problem with first call was spelling -- not type but should be types
elgg_list_entities(array('types' => 'object', 'subtypes' => 'MYSUBTYPE', . . .
Thanks DhrupDeScoop!
I'm afraid I will have further questions related with plugin development, but obviously in a new topic. :)