function apply_for_role_apply_for_role in Apply for role 6
Same name and namespace in other branches
- 5 apply_for_role.module \apply_for_role_apply_for_role()
- 7.2 apply_for_role.module \apply_for_role_apply_for_role()
- 7 apply_for_role.module \apply_for_role_apply_for_role()
Implementation of hook_apply_for_role().
We implement our own event to fire triggers.
Parameters
$op The operation that just occured: 'apply', 'approve', 'deny', 'remove'.:
$apply A role application object.:
File
- ./
apply_for_role.module, line 305 - Allows users to apply for roles.
Code
function apply_for_role_apply_for_role($op, $apply) {
// Keep objects for reuse so that changes actions make to objects can persist.
static $objects;
if (!module_exists('trigger')) {
return;
}
$user = user_load(array(
'uid' => $apply->uid,
));
$apply->user = $user;
$aids = _trigger_get_hook_aids('apply_for_role', $op);
$context = array(
'hook' => 'apply_for_role',
'op' => $op,
'user' => $user,
'apply_for_role' => $apply,
);
foreach ($aids as $aid => $action_info) {
if ($action_info['type'] != 'user') {
if (!isset($objects[$action_info['type']])) {
$objects[$action_info['type']] = _trigger_normalize_user_context($action_info['type'], $user);
}
$context['user'] = $user;
$context['apply'] = $apply;
actions_do($aid, $objects[$action_info['type']], $context);
}
else {
actions_do($aid, $user, $context);
}
}
}