You can do it with Roles
Have you tried:
$metadata = $ucountry[0];
$country = $metadata->value;
or:
$country = $ucountry[0]->value;
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.
UPDATE:
Sorry, we have got the lightbox to work in the embedded pages. We realised that with YouTube you need to put the embed URL into the href field and that any local calls to photos have to resolve to the same folder that Elgg is installed in... Only problem now is to resize the lightbox when displaying content like websites.
We would still appreciate some guidance with the second problem of querying a user's metadata from the elearning site. We have, as noted, their user GUID but can't seem to get the meta data such as 'country', 'firstname' etc
Problem 1:
The Lightbox CSS and JS must be loaded before you can use a lightbox. You have included the corresponding elgg_load_js / elgg_load_css lines above but they are commented out. If they are also commented out in your test code, you have to change that. Also, try 'link_class' instead of 'class' (especially if you try it on Elgg 1.9 already). I also had the problem that 'class' failed to work but 'link_class' worked (on Elgg 1.9 while 'class' worked on Elgg 1.8). You can also try
'link_class' => 'elgg-button elgg-button-action elgg-lightbox'
to get the default Elgg button layout.
Problem 2:
I guess the access level of the metadata is logged-in. So, you won't get the corresponding data when logged-out by default. You can turn off access level restrictions by
$access = elgg_set_ignore_access(true); // turn off access level restrictions
<now fetch the data and do what you want with it>
elgg_set_ignore_access($access); // restore access level restrictions
Does this existing elearning site also have a PHP Sessions-based login? If so, there's no safe way to use the Elgg engine in the same request.
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.