diff --git a/main/admin/index.php b/main/admin/index.php
index 2e44bbe95c..6edd06fa07 100644
--- a/main/admin/index.php
+++ b/main/admin/index.php
@@ -557,7 +557,6 @@ if (api_is_platform_admin()) {
$blocks['data_privacy']['extra'] = null;
$blocks['data_privacy']['search_form'] = null;
-
/* Chamilo.org */
$blocks['chamilo']['icon'] = Display::return_icon(
'platform.png',
diff --git a/main/admin/user_list_consent.php b/main/admin/user_list_consent.php
index c23188baf8..c9086e4e6b 100644
--- a/main/admin/user_list_consent.php
+++ b/main/admin/user_list_consent.php
@@ -19,9 +19,6 @@ api_protect_admin_script();
$this_section = SECTION_PLATFORM_ADMIN;
-
-
-
/**
* Prepares the shared SQL query for the user table.
* See get_user_data() and get_number_of_users().
@@ -143,10 +140,6 @@ function prepare_user_sql_query($getCount)
$keyword_extra_value
";
-
-
-
-
if (isset($keywordListValues['keyword_active']) &&
!isset($keywordListValues['keyword_inactive'])
) {
@@ -383,7 +376,7 @@ function modify_filter($user_id, $url_params, $row)
'';
if ($user_id != api_get_user_id()) {
- $result .= ' '.
Display::return_icon(
@@ -406,7 +399,6 @@ function modify_filter($user_id, $url_params, $row)
).
' ';
-
if ($is_admin) {
$result .= Display::return_icon(
'admin_star.png',
diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php
index 2c97f3b997..9dded82e33 100644
--- a/main/inc/lib/api.lib.php
+++ b/main/inc/lib/api.lib.php
@@ -275,7 +275,6 @@ define('LOG_TERM_CONDITION_ACCEPTED', 'term_condition_accepted');
define('LOG_USER_CONFIRMED_EMAIL', 'user_confirmed_email');
define('LOG_USER_REMOVED_LEGAL_ACCEPT', 'user_removed_legal_accept');
-
define('USERNAME_PURIFIER', '/[^0-9A-Za-z_\.]/');
//used when login_is_email setting is true
@@ -3877,10 +3876,10 @@ function convert_sql_date($last_post_datetime)
* the only one that is actually from the session, in case there are results from
* session 0 *AND* session n).
*
- * @param array $_course Course properties array (result of api_get_course_info())
- * @param string $tool Tool (learnpath, document, etc)
- * @param int $id The item ID in the given tool
- * @param int $session The session ID (optional)
+ * @param array $_course Course properties array (result of api_get_course_info())
+ * @param string $tool Tool (learnpath, document, etc)
+ * @param int $id The item ID in the given tool
+ * @param int $session The session ID (optional)
* @param int $user_id
* @param string $type
* @param string $group_id
diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php
index de429d1206..9cfa2ed407 100755
--- a/main/inc/lib/message.lib.php
+++ b/main/inc/lib/message.lib.php
@@ -2598,6 +2598,22 @@ class MessageManager
}
}
+ /**
+ * @param int $senderId
+ * @param string $subject
+ * @param string $message
+ */
+ public static function sendMessageToAllAdminUsers(
+ $senderId,
+ $subject,
+ $message
+ ) {
+ $admins = UserManager::get_all_administrators();
+ foreach ($admins as $admin) {
+ self::send_message_simple($admin['user_id'], $subject, $message, $senderId);
+ }
+ }
+
/**
* Execute the SQL necessary to know the number of messages in the database.
*
@@ -2621,20 +2637,4 @@ class MessageManager
return $row['count'];
}
-
- /**
- * @param int $senderId
- * @param string $subject
- * @param string $message
- */
- public static function sendMessageToAllAdminUsers(
- $senderId,
- $subject,
- $message
- ) {
- $admins = UserManager::get_all_administrators();
- foreach ($admins as $admin) {
- self::send_message_simple($admin['user_id'], $subject, $message, $senderId);
- }
- }
}
diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php
index 0fc06df642..e7adda5a19 100755
--- a/main/inc/lib/usermanager.lib.php
+++ b/main/inc/lib/usermanager.lib.php
@@ -6160,8 +6160,9 @@ SQL;
/**
* @param int $userId
*
- * @return string
* @throws Exception
+ *
+ * @return string
*/
public static function anonymizeUserWithVerification($userId)
{
@@ -6201,6 +6202,53 @@ SQL;
return $message;
}
+ /**
+ * @param int $userId
+ *
+ * @throws Exception
+ *
+ * @return string
+ */
+ public static function deleteUserWithVerification($userId)
+ {
+ $allowDelete = api_get_configuration_value('allow_delete_user_for_session_admin');
+ $deleteUserAvailable = api_get_configuration_value('deny_delete_users');
+
+ $message = '';
+
+ if (api_is_platform_admin() ||
+ ($allowDelete && api_is_session_admin())
+ ) {
+ $userToUpdateInfo = api_get_user_info($userId);
+ $currentUserId = api_get_user_id();
+
+ if ($userToUpdateInfo && $deleteUserAvailable &&
+ api_global_admin_can_edit_admin($userId, null, $allowDelete)
+ ) {
+ if ($userId != $currentUserId &&
+ UserManager::delete_user($userId)
+ ) {
+ $message = Display::return_message(
+ get_lang('UserDeleted').': '.$userToUpdateInfo['complete_name_with_username'],
+ 'confirmation'
+ );
+ } else {
+ $message = Display::return_message(
+ get_lang('CannotDeleteUserBecauseOwnsCourse'),
+ 'error'
+ );
+ }
+ } else {
+ $message = Display::return_message(
+ get_lang('CannotDeleteUser'),
+ 'error'
+ );
+ }
+ }
+
+ return $message;
+ }
+
/**
* @return EncoderFactory
*/
@@ -6298,50 +6346,4 @@ SQL;
return $url;
}
-
- /**
- * @param int $userId
- *
- * @return string
- * @throws Exception
- */
- public static function deleteUserWithVerification($userId)
- {
- $allowDelete = api_get_configuration_value('allow_delete_user_for_session_admin');
- $deleteUserAvailable = api_get_configuration_value('deny_delete_users');
-
- $message = '';
-
- if (api_is_platform_admin() ||
- ($allowDelete && api_is_session_admin())
- ) {
- $userToUpdateInfo = api_get_user_info($userId);
- $currentUserId = api_get_user_id();
-
- if ($userToUpdateInfo && $deleteUserAvailable &&
- api_global_admin_can_edit_admin($userId, null, $allowDelete)
- ) {
- if ($userId != $currentUserId &&
- UserManager::delete_user($userId)
- ) {
- $message = Display::return_message(
- get_lang('UserDeleted').': '.$userToUpdateInfo['complete_name_with_username'],
- 'confirmation'
- );
- } else {
- $message = Display::return_message(
- get_lang('CannotDeleteUserBecauseOwnsCourse'),
- 'error'
- );
- }
- } else {
- $message = Display::return_message(
- get_lang('CannotDeleteUser'),
- 'error'
- );
- }
- }
-
- return $message;
- }
}
diff --git a/main/social/personal_data.php b/main/social/personal_data.php
index 311e5df8ce..47ce1eb4b4 100755
--- a/main/social/personal_data.php
+++ b/main/social/personal_data.php
@@ -154,7 +154,6 @@ switch ($action) {
break;
}
-
$propertiesToJson = UserManager::getRepository()->getPersonalDataToJson($userId, $substitutionTerms);
if (!empty($_GET['export'])) {
@@ -268,11 +267,11 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
$permitionBlock .= get_lang('Date').': '.api_get_local_time($legalTime).'
';
$permitionBlock .= $formToString;
- /*$permitionBlock .= Display::url(
- get_lang('DeleteLegal'),
- api_get_self().'?action=delete_legal&user_id='.$userId,
- ['class' => 'btn btn-danger btn-xs']
- );*/
+ /*$permitionBlock .= Display::url(
+ get_lang('DeleteLegal'),
+ api_get_self().'?action=delete_legal&user_id='.$userId,
+ ['class' => 'btn btn-danger btn-xs']
+ );*/
} else {
// @TODO add action handling for button
$permitionBlock .= Display::url(
@@ -285,7 +284,6 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
$permitionBlock .= get_lang('NoTermsAndConditionsAvailable');
}
-
//Build the final array to pass to template
$personalData = [];
$personalData['data'] = $personalDataContent;
diff --git a/src/Chamilo/UserBundle/Repository/UserRepository.php b/src/Chamilo/UserBundle/Repository/UserRepository.php
index b788d5c6b7..e5545a6673 100644
--- a/src/Chamilo/UserBundle/Repository/UserRepository.php
+++ b/src/Chamilo/UserBundle/Repository/UserRepository.php
@@ -10,7 +10,6 @@ use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CoreBundle\Entity\SkillRelUser;
use Chamilo\CoreBundle\Entity\TrackELogin;
-use Chamilo\CoreBundle\Entity\Usergroup;
use Chamilo\CoreBundle\Entity\UsergroupRelUser;
use Chamilo\UserBundle\Entity\User;
use Doctrine\ORM\EntityRepository;
@@ -539,7 +538,6 @@ class UserRepository extends EntityRepository
$items = $extraFieldValues->getAllValuesByItem($userId);
$user->setExtraFields($items);
-
$lastLogin = $user->getLastLogin();
if (empty($lastLogin)) {
$login = $this->getLastLogin($user);