the default implementation doesnt check if a group is set to private before including it on the list

there should be some way to configure this per role but OG lacks it and i might take this to them if i get a chance to work on it, so the below might need some work on OG before it will be useful, i think it should be included anyway because it obeys OG's logic
im actually using the below + a check for role but that hack doesnt belong to this patch :-)

--- author_pane/modules/og.author-pane.inc 2009-09-02 14:04:08.000000000 -0700
+++ author_pane/modules/og.author-pane.inc      2009-09-02 14:08:22.000000000 -0700
@@ -15,7 +15,10 @@ function og_preprocess_author_pane(&$var
   if (isset($account->og_groups) && !empty($account->og_groups)) {
     $groups = array();
     foreach ($account->og_groups as $og_id => $og) {
-      $groups[] = l($og['title'], 'node/' . $og['nid']);
+      $og_node = node_load($og['nid']) ;
+      if ( ! $og_node['og_private'] ) {
+        $groups[] = l($og['title'], 'node/' . $og['nid']);
+      }
     }

     $variables['og_groups'] = implode(', ', $groups);

Comments

abaddon’s picture

please change the above line "+ if ( ! $og_node['og_private'] ) {" to "+ if ( ! $og_node->og_private ) {" before using it.. oops

michelle’s picture

Version: 6.x-1.1 » 6.x-2.x-dev

Ah, thanks for that. I only have one private group on my site and it never even occured to me. I'll put it in 2.x. 1.x is going to be deprecated as soon as I can get 2.0 released.

Michelle

abaddon’s picture

no problem, sorry for not putting it in a patch file but i was in a rush to finish off a site, i guess its not needed anymore now
thank YOU Michelle :-)

michelle’s picture

No worries. I don't mind doing the copying and pasting myself. I didn't get this added, yet, but will before I do the next alpha.

Michelle

michelle’s picture

Status: Needs review » Fixed

Ok, I committed a slightly modified version. All those extra node loads are performance killers so I check to see if og_access is even enabled before checking for private groups.

Thanks,

Michelle

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dries arnolds’s picture

If a user is a member of only private groups, the word 'None' doesn't appear. Maybe it shouldn't (cause the user is a member of prinvate groups), but there should be something mentioned there.

Maybe 'Groups: no public groups'