function opigno_quiz_app_init in Opigno Quiz App 7
Implements hook_init().
File
- ./
opigno_quiz_app.module, line 2041 - Module file. Defines module hooks.
Code
function opigno_quiz_app_init() {
if (user_is_logged_in()) {
$page_node = menu_get_object();
if (isset($page_node->type) && $page_node->type == "quiz") {
if (isset($page_node->og_group_ref['und'][0]['target_id'])) {
global $user;
foreach ($page_node->og_group_ref[LANGUAGE_NONE] as $group) {
if (og_is_member("node", $group['target_id'], 'user', $user, $states = array(
OG_STATE_ACTIVE,
))) {
opigno_db_insert_group_activity($group['target_id'], $user->uid);
if (module_exists("opigno_class_app")) {
$classes = opigno_class_app_classes_of_course_that_user_is_part_of($group['target_id'], $user->uid);
foreach ($classes as $class) {
opigno_db_insert_group_activity($class, $user->uid);
}
}
}
}
}
}
}
}