OG User Roles: Hooks
Last modified: March 7, 2009 - 19:32
hook_og_user_roles_gid
As of release 5.x-2.5.
Description
Hook to allow other modules to supply a Group Node ID to identify the group a user is in.
Parameters
No input parameters.
Return value
Returns a single Group Node ID which should be defined by your module as the current group context for the current user.
Sample code
<?php
/**
* implementation of hook_og_user_roles_gid();
*
* @param No input parameters
* @return $gid numeric value containing the current group node ID
*/
function filenode_og_user_roles_gid() {
if (arg(0) == 'og' && arg(1) == 'files') {
if (is_numeric(arg(2))) {
$gid = arg(2);
} elseif (is_numeric(arg(3))) { // E.g. og/files/create-subdir/104
$gid = arg(3);
}
}
if ($gid) return $gid;
}
?>Reference
http://drupal.org/node/176390
