function opigno_set_user_as_student in Opigno 7
1 string reference to 'opigno_set_user_as_student'
- opigno_form_alter in ./
opigno.module - Implements hook_form_alter().
File
- ./
opigno.module, line 343 - Contains all hook_implementations and module specific API.
Code
function opigno_set_user_as_student($form, &$form_state) {
global $user;
$gid = $form['gid']['#value'];
$node = node_load($gid);
$roles = og_roles("node", $node->type, $node->nid, $force_group = FALSE, $include_all = TRUE);
foreach ($roles as $index => $role) {
if ($role == 'student') {
og_role_grant("node", $gid, $user->uid, $index);
}
}
}