Using lightbox and accordians etc in embedded Elgg site

Hi,

We have wrapped Elgg around an elearning site after a client asked for a social media site to 'front' the elearning site that we had already developed. We are using:

require_once("../ac/engine/start.php");

Problem 1:

This has worked nicely in terms of hooking into Elgg navigation and users etc but we are having an incredible amount of trouble working out how to use lightboxes etc in the elearning site pages - in fact a lot of our Jquery 'tools' were broken when we did the integration but we haven't been able to replace them with the ones native to Elgg when we try and access this from the elearning pages.

 

For example, If we use this code:

<?php       

//elgg_load_js('lightbox');
//elgg_load_css('lightbox');

$content = elgg_view('output/url', array(
    'text' => 'Lightbox Test',
    'href' => 'http://google.com&#39;,
    'class' => 'elgg-lightbox'
));

echo elgg_view_page('Test', $content);      
                
  ?>  

An Elgg navigation bar and toolbar is loaded into the page wherever the code resides along with a link to 'Lightbox Test' which doesn't function. 

Problem 2:

We need to query the Elgg database from these external pages to access a users (not a logged in user) meta data. We can access their user GUID and the data in the user_entity table but not their metadata where we store other critical info for the elearning. So far all attempts have failed and we get back empty arrays etc. We don't have any trouble accessing the data of a logged in Elgg user.

The site is under a single domain where the Elgg 'community' is a sub-directory and the 'elearning site' another sub-directory in the root of the domain folder.

We would really appreciate a shove in the right direction for this.

  • 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.