You are here

function _og_role_watchdog_row_group_name in Role Watchdog 7.2

Same name and namespace in other branches
  1. 7 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 264
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 = node_load($gid);
    if ($group) {

      //@todo: Not sure if we need the default access check here. Wouldn't those be set on the user in some other place

      // before you got to this point?
      $query_gid = og_is_group_default_access('node', $gid) ? 0 : $gid;
      $og_roles = og_roles('node', $group->type, $gid);
      $group_name = l($group->title, 'node/' . $group->nid);
      if ($og_rid > 0) {
        $role = $og_roles[$og_rid];
      }
      else {
        $role = t("undefined");
      }
    }
  }
  else {
    $role = $roles[$rid];
  }
  return array(
    $group_name,
    $role,
  );
}