You are here

function _og_role_watchdog_row_group_name in Role Watchdog 7

Same name and namespace in other branches
  1. 7.2 modules/og_role_watchdog/og_role_watchdog.pages.inc \_og_role_watchdog_row_group_name()

Determine the string to put in the "group name" column of an og role watchdog report table.

Parameters

$gid: The group ID that the role change happened in, or NULL

$rid: The global role id that was given or removed, or ROLE_WATCHDOG_NO_ROLE if a group role was given or removed.

$og_rid: The group role id that was given or removed, or NULL if a global role was given or removed.

$roles: An associative array mapping each global role id to its label

Note that $gid and $og_rid are set iff $rid is ROLE_WATCHDOG_NO_ROLE.

3 calls to _og_role_watchdog_row_group_name()
og_role_watchdog_grants in modules/og_role_watchdog/og_role_watchdog.pages.inc
og_role_watchdog_history in modules/og_role_watchdog/og_role_watchdog.pages.inc
Display tab page from menu callback.
og_role_watchdog_report in modules/og_role_watchdog/og_role_watchdog.pages.inc

File

modules/og_role_watchdog/og_role_watchdog.pages.inc, line 265
User page callbacks for the role_watchdog module.

Code

function _og_role_watchdog_row_group_name($gid, $rid, $og_rid, $roles) {
  $group_name = '-';
  if ($rid == ROLE_WATCHDOG_NO_ROLE) {
    $group = og_load($gid);
    if ($group) {
      $group_entity = og_get_group($group->entity_type, $group->etid);
      $query_gid = og_is_group_default_access($gid) ? 0 : $gid;
      $og_roles = og_roles($query_gid);
      $group_name = l($group_entity->label, $group->entity_type . '/' . $group->etid);
      $role = $og_roles[$og_rid];
    }
  }
  else {
    $role = $roles[$rid];
  }
  return array(
    $group_name,
    $role,
  );
}