We're using the 'validatebyadmin' plugin but need to query some of the metadata entered on registration so that admin has more info regarding the registrant.
Using:
access_show_hidden_entities(TRUE);
$ucountry = elgg_get_metadata(array('guid' => $user->guid, 'metadata_name' => country));
We are able to create and array and if we use print_r(array_values($ucountry)); we can output the array and it appears like this:
Array ( [0] => ElggMetadata Object ( [attributes:protected] => Array ( [time_created] => 1416305932 [type] => metadata [id] => 9644 [entity_guid] => 3026 [name_id] => 482 [value_id] => 557 [value_type] => text [owner_guid] => 3026 [access_id] => 1 [enabled] => yes [name] => country [value] => DE ) [valid:protected] => ) ) 1
What we need to extract from this is the country value of 'DE' and set it as a variable but we are having no luck reading it from the array. Has this something to do with 'attributes:protected'? ... Is there any way around this as we really need to get more of the metadata to ensure that the registrants are valid.
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.
- Juho Jaakkola@juho.jaakkola

Juho Jaakkola - 0 likes
- Paweł Sroka@srokap

Paweł Sroka - 0 likes
- praxmatrix@praxmatrix

praxmatrix - 0 likes
You must log in to post replies.Have you tried:
or:
See how properties are accessed on entities http://learn.elgg.org/en/1.9/guides/database.html Generally you probably shouldn't be using elgg_get_metadata but one of elgg_get_entities_*
If you don't know what are protected properties in PHP objects, it might be useful to grab some additional tutorial just for PHP.
Thanks to Juho and Pawel - now resolved.