How to add another tab

I would like to add extra tab in riverdasboard to display logged in user's groups activity.

Anyone knows or has code for this?


  • The best method I have found is to buy Vazco's topbar plugin. It has worked well for me.


    I use {$url}pg/groups/world/?filter=active to point to the latest discussions.

    Hope it helps.

  • Thank you Peter,

    I need another tab in riverdash navigation not in the topbar. Also the tab needs to display activity of Groups that user ( logged in user viewing dashboard) is a member of not all Groups.

    I know some code to get list of user's groups and such but the code that switches reiverdashboard tabs content is kind of a mistery. I see it pulls info by type and subtype but how to separate it on this new tab to display user's groups activity?


  • Anyone can shed some light?

    $owner = page_owner_entity(); or $_SESSION['user']->guid;

       $groups = elgg_get_entities_from_relationship(array('relationship'=> 'member', 'relationship_guid'=> $owner->getGUID(), 'inverse_relationship'=> FALSE, 'type'=> 'group', 'limit'=> 5));

    that will display list of 5 user's groups.

    How can I get latest activity from the mix of these groups as a river?

    Thanks a lot.

  • i already did this by way of adding a group dropdown selector on the dashboard that filters the river by group..

    i used the SQL thats in the groupriver plugin.

    shyam's suggestion may be just the same, i'm not 100% certain.

  • Writing SQL is going to be more efficient, but it comes with the risk of having to work a bit harder to maintain it over time.

    I think I should elaborate my answer a bit.

    You need to loop through each of $groups, call get_river_items with the group guid and store the results in a master array and sort it if you want it ordered right.

    Render it with the 'river/item/list' view.

    Not much fun, but that is one of the ways :)

    Edit: you can actually pass on subject and object guids as arrays in get_river_items. That should make things much easier and save you the sorting troubles.

  • Thanks guys, I will try and play with that.

    Tunist,  I also use sql but could not get the code to work in riverdashboard. I use this code on profile though. It sort of works but it picks up only one group out of the list.

    Here is my code maybe you guys can adjust or suggest changes to be made. Thanks Again.:

        $owner = page_owner_entity();

       $groups = elgg_get_entities_from_relationship(array('relationship'=> 'member', 'relationship_guid'=> $owner->getGUID(), 'inverse_relationship'=> FALSE, 'type'=> 'group', 'limit'=> 1));

     foreach($groups as $gr){

        $group_guid = $gr->guid;
        $pagination = false;
        $limit = 20; 
    if ($group_guid){   

            $group_guid = $gr->guid;
            $limit = 20; 
            $offset = (int) get_input('offset', 0);

            // Sanitise variables -- future proof in case they get sourced elsewhere
            $offset = (int) $offset;
            $group_guid = (int) $group_guid;

            $sql = "SELECT {$CONFIG->dbprefix}, {$CONFIG->dbprefix}river.type, {$CONFIG->dbprefix}river.subtype, {$CONFIG->dbprefix}river.action_type, {$CONFIG->dbprefix}river.access_id, {$CONFIG->dbprefix}river.view, {$CONFIG->dbprefix}river.subject_guid, {$CONFIG->dbprefix}river.object_guid, {$CONFIG->dbprefix}river.posted FROM {$CONFIG->dbprefix}river INNER JOIN {$CONFIG->dbprefix}entities AS entities1 ON {$CONFIG->dbprefix}river.object_guid = entities1.guid INNER JOIN {$CONFIG->dbprefix}entities AS entities2 ON entities1.container_guid = entities2.guid WHERE entities2.guid = $group_guid OR {$CONFIG->dbprefix}river.object_guid = $group_guid ORDER BY posted DESC limit {$offset},{$limit}";

            $items = get_data($sql);

                $river_items = elgg_view('river/item/list',array(
                                                    'limit' => $limit,
                                                    'offset' => $offset,
                                                    'items' => $items,
                                                    'pagination' => $pagination
     $griverdashboard .= elgg_view('riverdashboard/container', array('body' => $river_items . elgg_view('riverdashboard/js')));


  • you need to change/remove the 'limit' variable to increase the number of groups that are displayed, the variable is set to '1' in the code you posted.

    i looked at posting the code i have here that will add a dropdown selector, however the changes include alterations to quite a few files in riverdashboard and also autodash due to the way i have integrated the dropdown into my site.

    you can see how the dropdown appears in my site here:

    - i can upload the altered mods if you like?

  • Tunist, that would be great if you would upload altered mods. Internally grateful. :-)

    I tried my code with limit 99 but still it only pulls activity from one, last group in the list, it does not mix all groups or show activity from all groups.