Commit 8e6c286b authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1748782: Fix clash of 'active' values in user search results



We were confusing user active with auth active values from db call
So changed the auth 'active' to 'authactive'

Also add warning message to top of admin/users/edit.php page to
indicate that user has expired (similar to when user is suspended)

behatnotneeded

Change-Id: I437665cffa6f2d372ef4c5c39fad7bec183e3a2d
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 6b8396d6)
parent 807c95a0
......@@ -586,9 +586,9 @@ function edituser_site_submit(Pieform $form, $values) {
redirect('/admin/users/edit.php?id='.$user->id);
}
// Suspension/deletion controls
$suspended = $user->get('suspendedcusr');
$expired = ($user->get('active') == 0 && $user->get('expirymailsent') && !$suspended);
if (empty($suspended)) {
$suspendform = pieform(array(
'name' => 'edituser_suspend',
......@@ -912,6 +912,10 @@ function edituser_institution_submit(Pieform $form, $values) {
$smarty = smarty();
$smarty->assign('user', $user);
$smarty->assign('expired', $expired);
if ($expired) {
$smarty->assign('expiredon', get_string('expiredinfo', 'admin', format_date($user->get('expiry'), 'strftimedate')));
}
$smarty->assign('suspended', $suspended);
if ($suspended) {
$smarty->assign('suspendedby', get_string('suspendedinfo', 'admin', $suspender, $suspendedtime));
......
......@@ -803,6 +803,8 @@ $string['suspendedreasondescription'] = 'The text that will be displayed to the
$string['unsuspenduser'] = 'Unsuspend user';
$string['thisuserissuspended'] = 'This user has been suspended.';
$string['suspendedinfo'] = 'This user was suspended by %s on %s.';
$string['expiredinfo'] = 'This user\'s account expired on %s.';
$string['unexpiredesc'] = 'To re-activate this account, uncheck the "Account expires" field below and save your changes.';
$string['deleteuser'] = 'Delete user';
$string['userdeletedsuccessfully'] = 'User deleted successfully';
$string['confirmdeleteuser'] = 'Are you sure you want to delete this user?';
......
......@@ -541,7 +541,7 @@ class PluginSearchInternal extends PluginSearch {
$data = get_records_sql_assoc('
SELECT ' . $firstcols . ',
u.firstname, u.lastname, u.preferredname, u.username, u.email, u.staff, u.profileicon,
u.lastlogin, u.active, NOT u.suspendedcusr IS NULL as suspended, au.instancename AS authname, au.active
u.lastlogin, u.active, NOT u.suspendedcusr IS NULL as suspended, au.instancename AS authname, au.active AS authactive
FROM {usr} u INNER JOIN {auth_instance} au ON u.authinstance = au.id ' . $join . $where . '
ORDER BY ' . $sort . ', u.id',
$values,
......
......@@ -12,6 +12,13 @@
{/if}
{$suspendform2|safe}
</div>
{elseif $expired}
<div class="suspendederror admin-warning alert alert-warning">
<h3 class="title">{$expiredon}</h3>
<div class="detail">
{str tag=unexpiredesc section=admin}
</div>
</div>
{/if}
<div class="row">
<div class="col-md-9 main">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment