diff --git a/main/admin/user_list.php b/main/admin/user_list.php index 63367fab70..1d2a7f3cd5 100755 --- a/main/admin/user_list.php +++ b/main/admin/user_list.php @@ -688,8 +688,8 @@ if (!empty($action)) { $number_of_deleted_users = 0; if (is_array($_POST['id'])) { foreach ($_POST['id'] as $index => $user_id) { - if($user_id != $_user['user_id']) { - if(UserManager :: delete_user($user_id)) { + if ($user_id != $_user['user_id']) { + if (UserManager::delete_user($user_id)) { $number_of_deleted_users++; } } diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 41a38fe251..09c47e7907 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -459,6 +459,7 @@ class UserManager )); $hook->notifyCreateUser(HOOK_EVENT_TYPE_POST); } + return $return; } @@ -649,9 +650,6 @@ class UserManager WHERE lastedit_user_id = '".$user_id."'"; Database::query($sql); - - - // Delete user from database $sql = "DELETE FROM $table_user WHERE id = '".$user_id."'"; Database::query($sql); @@ -690,7 +688,7 @@ class UserManager * @assert (-1) === false * @assert (array(-1)) === false */ - static function delete_users($ids = array()) + public static function delete_users($ids = array()) { $result = false; $ids = is_array($ids) ? $ids : func_get_args(); @@ -715,7 +713,7 @@ class UserManager * @assert (null) === false * @assert (array(-1)) === false */ - static function deactivate_users($ids = array()) + public static function deactivate_users($ids = array()) { if (empty($ids)) { return false; @@ -745,7 +743,7 @@ class UserManager * @assert (null) === false * @assert (array(-1)) === false */ - static function activate_users($ids = array()) + public static function activate_users($ids = array()) { if (empty($ids)) { return false; @@ -1271,6 +1269,7 @@ class UserManager while ($row = Database::fetch_array($rs)) { $result[] = $row; } + return $result; } @@ -1282,8 +1281,12 @@ class UserManager * @todo optional course code parameter, optional sorting parameters... * @todo security filter order by */ - public static function get_user_list($conditions = array(), $order_by = array(), $limit_from = false, $limit_to = false) - { + public static function get_user_list( + $conditions = array(), + $order_by = array(), + $limit_from = false, + $limit_to = false + ) { $user_table = Database :: get_main_table(TABLE_MAIN_USER); $return_array = array(); $sql_query = "SELECT * FROM $user_table"; @@ -1319,8 +1322,12 @@ class UserManager * @todo optional course code parameter, optional sorting parameters... * @todo security filter order_by */ - public static function get_user_list_like($conditions = array(), $order_by = array(), $simple_like = false, $condition = 'AND') - { + public static function get_user_list_like( + $conditions = array(), + $order_by = array(), + $simple_like = false, + $condition = 'AND' + ) { $user_table = Database :: get_main_table(TABLE_MAIN_USER); $return_array = array(); $sql_query = "SELECT * FROM $user_table"; @@ -1442,7 +1449,7 @@ class UserManager try { mkdir($rootPath, $perm); } catch (Exception $e) { - // + error_log($e->getMessage()); } } } @@ -1511,7 +1518,6 @@ class UserManager } $gravatarEnabled = api_get_setting('gravatar_enabled'); - $anonymousPath = Display::returnIconPath('unknown.png', $pictureAnonymousSize); if ($pictureWebFile == 'unknown.jpg' || empty($pictureWebFile)) { @@ -1804,8 +1810,8 @@ class UserManager /** * Remove a user production. * - * @param int $user_id User id - * @param string $production The production to remove + * @param int $user_id User id + * @param string $production The production to remove */ public static function remove_user_production($user_id, $production) { @@ -2053,6 +2059,7 @@ class UserManager { $extraField = new ExtraField('user'); $data = $extraField->get_handler_field_info_by_field_variable($variable); + return empty($data) ? true : false; }