Group Tab in Activity Page

There was a plugin using which a new tab for "Groups" was created in the activity page next to "All, friends, Mine" tab.

I used that plugin when I was using Elgg 1.8 but I guess there was no compatible version released for 1.9+ so i stopped using it.

I am not able to recall the plugin name. Can anyone help me with that. I would like to update the source code to support 1.9+ (if not yet available)

  • This is not exactly what I was looking for. This plugin will create multiple tabs for individual groups and that also based on user preference.

    The plugin that I am looking for will create a single tab called "Groups" and will show all the group activities for the groups the user is a member of.

  • So now I have this code to get all the group activities for the logged in user.

    <?php
    include("../engine/start.php");
    $db_prefix = elgg_get_config('dbprefix');
    $user = elgg_get_logged_in_user_entity();
    if ($user) {
      $groups = $user->getGroups('', false);
      $group_guids = array();
      foreach ($groups as $group) {
       $group_guids[] = $group->getGUID();
      }
     
      $guids_in = implode(',', array_unique(array_filter($group_guids)));
    
      if(empty($guids_in)){
            echo "Not a member of any group";
      }else{
        echo elgg_list_river(array(
            'pagination' => true,
            'joins' => array("JOIN {$db_prefix}entities e ON e.guid = rv.object_guid"),
            'wheres' => array("e.container_guid IN({$guids_in})"),
            'order_by' => 'e.time_created desc'
         ));
      }
    }
    ?>

    Now I need to know How to create a new tab "Groups" next to "All, Mine, Friends" tab in activity page?

     

     

  • Make a custom filter menu for it.

    just add a new context 'group' and set by priority.

    Also, I don't understand why you need this piece in your code:

    include("../engine/start.php");

     

     

  • including start.php was just for testing purpose. I created a standalone file to test the code and the query. That line will be removed once i integrate that file in elgg.

  • @RvR.. Done creating the custom filter menu.

    Now I want the content of my file to be viewed at mydomain.com/activity/groups

    I created a page handler for "activity" as below.

    function group_river_init() {
        elgg_register_page_handler('activity', 'activity_page_handler');
                
    }
    
      function activity_page_handler($segments) {
        gatekeeper();
        if ($segments[0] == 'groups') {
            group_river_activity($page);
            return true;
        }
        return true;
    }

    But doing so removed all the content of the activity page. All I am seeing is a blank page.

    Only "mydomain.com/activity/groups&quot; is working and that too I am not able to see the filter menu on the page.

  • I found an alternative instead of copying and editing content.php. I can add the custom filter using the below code in my start.php file.

    function group_river_init() {
        elgg_register_menu_item('filter', array(
         'name' => 'groups',
          'href' => '/activity/groups',
          'text' => "Groups",
          'priority' => 500,
      ));
                
    }

    Now, can please some one help me how can i add my file "/mod/myplugin/views/default/group_river/group_activity.php" to "/activity/groups" url.

     

  • I don't know how to do it w/o overriding  _elgg_river_page_handler and creating a custom layout/view with your new type into river.php page aka groups