/** * Uncompletes lesson * * @access public * @return void */ public static function uncompleteLesson() { if (!ThemexCore::checkOption('lesson_retake')) { ThemexCore::removeUserRelation(get_current_user_id(), self::$data['ID'], 'lesson'); if (!empty(self::$data['quiz'])) { ThemexCore::removeUserRelation(get_current_user_id(), self::$data['quiz']['ID'], 'questions'); ThemexCore::removeUserRelation(get_current_user_id(), self::$data['quiz']['ID'], 'answers'); } } }
/** * Deletes course member * * @access public * @param int $ID * @return void */ public static function deleteUser($ID) { ThemexCore::removeUserRelation($ID, 0, 'plan'); ThemexCore::removeUserRelation($ID, 0, 'course'); ThemexCore::removeUserRelation($ID, 0, 'certificate'); ThemexCore::removeUserRelation($ID, 0, 'lesson'); ThemexCore::removeUserRelation($ID, 0, 'quiz'); }
/** * Removes user relation * * @access public * @param int $ID * @param array $data * @return void */ public static function removeRelation($ID, $data) { $relation = themex_value('relation_id', $data); $type = themex_value('relation_type', $data); if (in_array($type, array('shop', 'product'))) { ThemexCore::removeUserRelation($ID, $relation, $type); if ($type == 'shop') { $relations = count(ThemexCore::getUserRelations(0, $relation, 'shop')); ThemexCore::updatePostMeta($relation, 'admirers', $relations); } } die; }