"Views Filter" to filter for all Subgroups of current group, that's what i would need!
And (it was mentioned before) a possibility to have the tree and members shown in a block instead of being placed in the content.
thanks for contributing!

Comments

Anonymous’s picture

bumping now all threads i kind find about this subject.
is it really that hard piece of brainwork or don´t any users of subgroups need such a group hirarchy view ???
can´t believe it ...

ezra-g’s picture

@mokkashock - This should be possible.

The way I imagine it working would be by looking up the ancestry tree for the node presented in an argument and filter based on children of that node. I would be happy to review any patches towards this feature.

gabriel.’s picture

I'd also like to be able to filter results to only subgroups of a certain group.

Also, an "Is a subgroup of..." option (specifying the inverse relationship) would be very helpful too.

somebodysysop’s picture

As opposed to coding this in a module, I created a code snippet to put into a block. This code will:

a. List the subgroup hiearchy as in "Tree".
b. If you are at the bottom of the hiearchy, it will list the subgroup parents.

My goal here was simply to have a block which will allow you to navigate a subgroup hiearchy no matter where you are in it.


  $group_node = og_get_group_context();

  $gid02 = $group_node->nid;

  $gid = (int)$gid02;

  // Get parent groups
  print "<ul>";
  $stop = 'n';
  $gidwork = $gid;
  $links = array();
  $count = 0;
  while ($stop == 'n') {    
    if ($selected = og_subgroups_get_parents($gidwork)) {
      foreach ($selected as $nid => $group) {
        $links[$count]['gid'] = $nid;
        $links[$count]['title'] = $group['title'];
        $gidwork = $nid;
	$count++;
      }
    } else {
      $stop = 'y';
    }
  }
  // Links are currently in ascending from current gid.  Need to be reversed to
  // descending order for display.
  krsort($links);
  foreach ($links as $key => $group) {
    print '<li>' . l($group['title'], 'node/'. $group['gid']);
  }
  print "</ul>";

  return lesspaper_page($gid); 
  // This is my version of og_subgroups_page() modified to my tastes.
  // You can simply use: return "og_subgroups_page($gid)" instead.

For the "Show block on specific pages:" section, I select: "Show if the following PHP code returns TRUE (PHP-mode, experts only)." and insert the following code:

  // We want to display this block if we are in group context 
  global $user;
  $display = FALSE;
  if (module_exists('og')) {
    if ($node = og_get_group_context()) {
      $display = TRUE;     
    }
  }
  return $display;
amitaibu’s picture

SomebodySysop,
Thanks for the snippet, however please note that 5.x-4.DEV already comes with this functionality built-in. Give it a try :)

somebodysysop’s picture

Majorly cool. Wish I'd known! Thanks!

somebodysysop’s picture

Version: 5.x-2.0 » 5.x-4.x-dev

Installed 5.x-4.x-dev. No dialog in update.php for og_subgroups. Now get this error:

user warning: Table 'drupal_sc.og_subgroups' doesn't exist query: SELECT ogh.parent AS gid FROM node n INNER JOIN og_subgroups ogh ON n.nid = ogh.gid WHERE n.nid = 128 in /var/www/html/websites/drupal/sc/includes/database.mysql.inc on line 172.

What should I do?

somebodysysop’s picture

Never mind. Found the patch here: http://drupal.org/node/266659

Looks good!

One small itsey, bitsey question:

The subgroups block will appear whether the group has subgroups or not. Any suggested resolution to this: That is, it only appears if the current group has parents or children?

amitaibu’s picture

Version: 5.x-4.x-dev » 5.x-3.x-dev
Status: Active » Closed (won't fix)

@SomebodySysop,
1. If the patch - #266659: Migration tool for 5.x-3 to 5.x.4, works for you please RTBC.
2. Regarding your question, I opened a new issue #267173: Show sub groups block only when group has parents/ children

somebodysysop’s picture

1. If the patch - #266659: Migration tool for 5.x-3 to 5.x.4, works for you please RTBC.

Yes, the patch works. I don't know what RTBC means.

amitaibu’s picture

RTBC = Ready To Be Committed :)

10x.

ezra-g’s picture

Awesome! Thanks Amitaibu and SomebodySysop for the quick response on this!!

ezra-g’s picture

oops -- meant to post this at #266659: Migration tool for 5.x-3 to 5.x.4.

greg.1.anderson’s picture

Version: 5.x-3.x-dev » 6.x-1.x-dev
Status: Closed (won't fix) » Closed (fixed)

This is implemented in the 6.x-1.x branch in the og_subgroups_views module, which is included in the og_subgroups project. (Pro tip: check the contents of the project for features before looking in the issue queue. Fortunately I figured this out before writing my own views filter; adding this note in case someone else ends up here like I did.)