Pull popular group names from elgg

Hello,

I am trying to pull the popular group names and display in my site. 

What I am trying to do is ":

require_once('../elgg/vendor/autoload.php');
\Elgg\Application::start();
/**
 * Renders a list of groups with most members
 */
echo elgg_list_entities_from_relationship_count(array(
'type' => 'group',
'relationship' => 'member',
'inverse_relationship' => false,
'full_view' => false,
'no_results' => elgg_echo('groups:none'),
));
 
But I am getting a blank output.
How can I pull popular group names it via elgg engine?

Any code / help would be appreciated.

 

Thanks

  • Check the error log for relevant entries. In require_once() you have a relative path. Depending on the location of the file of your code the relative path might be wrong.

    The code as such looks right. Without knowing how you implement it exactly, I can't say if the way you do it is right or not. For example, if you add your code in a view of an Elgg plugin you wouldn't need to boot the Elgg engine explicitely. The best way to proceed also depends on what you want to achieve in the first place. If you want to add the output of popular groups on the index/home page of your Elgg site, you would rather add the code for example to the view of the index page.