function og_is_group_admin in Organic groups 6
Same name and namespace in other branches
- 6.2 og.module \og_is_group_admin()
Determine whether user can act as a group administrator for a given group.
Parameters
string $node : A group node object.
string $account: A user account object. If not supplied, the current user is assumed.
Return value
boolean
7 calls to og_is_group_admin()
- og_broadcast_access in ./og.module 
- Access callback: og_notifications (or similar) is required for the broadcast tab. Override menu item to amend.
- og_menu_access_invite in ./og.module 
- og_menu_access_node_edit in ./og.module 
- og_menu_access_unsubscribe in ./og.module 
- Check if current user may unsubscribe the specified user from the specified group.
- og_panels_menu in modules/og_panels/ og_panels.module 
File
- ./og.module, line 297 
Code
function og_is_group_admin($node, $account = NULL) {
  if (is_null($account)) {
    $account = $GLOBALS['user'];
    // Adventurous modules can cause us to arrive here before og_init() has fired.
    // See http://drupal.org/node/285696
    if ($account->uid && !isset($account->og_groups)) {
      $account = user_load(array(
        'uid' => $account->uid,
      ));
    }
  }
  return og_is_group_type($node->type) && (user_access('administer nodes', $account) || !empty($account->og_groups[$node->nid]['is_admin']));
}