Sidharth

Send private message

You must be logged in to send a private message.

Group membership

Activity

  • Sidharth replied on the discussion topic Creating a tree view Hierarchy for groups and sub groups...??
    i have written a code to get details of groups which are joined by the user ... but how to differentiate between child and parent...? please help me out for that...   function groups_yours_menu() {     $viewer =... view reply
  • Sidharth replied on the discussion topic Creating a tree view Hierarchy for groups and sub groups...??
    im w8ing for an answer....!!! :( please help me out ? ?? view reply
  • Sidharth joined the group India Community
  • i have installed elgg to my system.  also added a AU Subgroups plugin. Wish to create a tree view hierarchy which shows all the groups and sub-group of a particular user Login .. please Help me out (step by step)... Im new to elgg . . . For...
    • i have written a code to get details of groups which are joined by the user ... but how to differentiate between child and parent...? please help me out for that...

       

      function groups_yours_menu() {

          $viewer = elgg_get_logged_in_user_entity();

          //read viewer's groups
          $content = elgg_get_entities_from_relationship(array(
              'type' => 'group',
              'relationship' => 'member',
              'relationship_guid' => elgg_get_logged_in_user_guid(),
              'inverse_relationship' => false,
              'limit' => 0,
          ));
          
          //create array of entries ($content object had duplicate entries, array keys prevent duplicates (sry for being lazy)
          $groupmenu_array = Array();
          foreach ($content as $mygroup) {
              $groupmenu_array[(string)$mygroup->get('guid')] = $mygroup->get('name');
              //print_r ($mygroup);
          }

          //sort array while keeping the IDs
          asort($groupmenu_array);
       
          //create HTML code out of array
          foreach ($groupmenu_array as $group_guid=>$group_name) {
              $groupmenu .= '<div>'.elgg_view('output/url', array('href' => "groups/profile/$group_guid",'text' => $group_name,    'is_trusted' => true,)).'</a></div>';
              
          }    
          
          //add wrapping divs around menu and logo (</a> to close link generated by register_menu_item)
          /*$groupmenu = '</a><div id="topbar-mygroups" style="height:22px;">'. elgg_view('output/url', array('href' => "groups/member/{$viewer->username}",'text' => elgg_view_icon('share'), 'is_trusted' => true, 'title' => 'Your groups')) . '<div id="topbar-groupmenu" style="display:none; position:absolute; background-color:#EEEEEE; white-space:nowrap; padding:3px; margin-top: 4px;">' . $groupmenu . '</div></div><a>';*/
          //adding the new menu to the topbar
              $value = array(
              'name' => 'mygroups',
              'href' => "",
              'text' => $groupmenu,
              'title' => elgg_echo('groups:yours'),
              'priority' => 250,
          );

        //  echo "<br><br>";
        //  var_dump($value);
          elgg_register_menu_item('site', $value);

       

       

    • Interesting...!!
      I would also like to know about it.

    • There are some functions in the plugin you can use, I don't remember them offhand but you should be able to find them by their names in lib/functions.php

      It will be something like au_subgroups_get_children($group)

  • Sidharth joined the group Elgg Technical Support
  • Sidharth has a new avatar
    Sidharth
  • Sidharth added a new discussion topic Creating a tree view Hierarchy for groups and sub groups... in the group Beginning Developers
    i have installed elgg to my system.  also added a AU Subgroups plugin. Wish to create a tree view hierarchy which shows all the groups and sub-group of a particular user Login .. please Help me out (step by step)... Im new to elgg . . . For...