I have a variety of content types available to a group. For the most part, only the group admin can create these nodes. However, there is one content type that all group members can create.

So, since the group non-admin member has permissions to create this content type, they can view the block (which will have one link).

In my use case scenario, I only want the group admin to view the admin block.

Unfortunately, this is not working yet... still hammering away.. will return with something shortly...

Comments

ydahi’s picture

Here is my approach, seems to be working fine:

/**
 * Implements hook_og_permission().
 */
function og_admin_block_og_permission() {
  return array(
    'view og admin block' => array(
      'title' => t('View OG Admin Block'),
      'description' => t('View OG Admin Block Menu'),
    ),
  );
}
  // If there are no links do not display the block.
  if (empty($block['content'])) {
    return NULL;
  }
  elseif (!(og_user_access($context['group_type'], $context['gid'], 'view og admin block'))){
	return NULL;
  }
  else {
	$block['content']['#theme_wrappers'] = array('menu_tree__og_admin_block');
  }

Let me know what you think.

__cj’s picture

Status: Active » Closed (fixed)

Good idea. I've committed this.