function phorum_user_delete($user_id) { if(isset($GLOBALS["PHORUM"]['cache_users']) && $GLOBALS["PHORUM"]['cache_users']) { phorum_cache_remove('user',$user_id); } return phorum_db_user_delete($user_id); }
/** * Delete a Phorum user. * * @param integer $user_id * The user_id of the user that has to be deleted. */ function phorum_api_user_delete($user_id) { settype($user_id, "int"); /** * [hook] * user_delete * * [description] * Modules can use this hook to run some additional user cleanup * tasks or or to keep some external system in sync with the Phorum * user data. * * [category] * User data handling * * [when] * Just before a user is deleted. * * [input] * The user_id of the user that will be deleted. * * [output] * The same user_id as the one that was used for the hook * call argument. * * [example] * <hookcode> * function phorum_mod_foo_user_delete($user_id) * { * // Get user info * $user = phorum_api_user_get($user_id); * * // Log user delete through syslog. * openlog("Phorum", LOG_PID | LOG_PERROR, LOG_LOCAL0); * syslog(LOG_NOTICE, "Delete user registration: $user[username]"); * * return $user_id; * } * </hookcode> */ if (isset($GLOBALS['PHORUM']['hooks']['user_delete'])) { phorum_hook('user_delete', $user_id); } // If user caching is enabled, we remove the user from the cache. if (!empty($GLOBALS['PHORUM']['cache_users'])) { phorum_cache_remove('user', $user_id); } // Remove the user and user related data from the database. phorum_db_user_delete($user_id); // Delete the personal user files for this user. require_once dirname(__FILE__) . '/file_storage.php'; $files = phorum_api_file_list(PHORUM_LINK_USER, $user_id, 0); foreach ($files as $file_id => $file) { phorum_api_file_delete($file_id); } }
/** * Delete the user. * @return boolean */ public function delete() { global $PHORUM; $PHORUM['DATA']['LANG']['AnonymousUser'] = '******'; if (phorum_db_user_delete($this->getUserId())) { $this->m_exists = false; return true; } else { return false; } } // fn delete