diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2014-04-01 20:01:57 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2014-04-01 20:01:57 +0400 |
commit | c5a8686a60da743f750e89a342b7ce1e30ea9865 (patch) | |
tree | 3a6e9bec7d09a320da92861418cd2c9bac6f3639 /plugins | |
parent | d41fe2ae92d734b78d67e43335b839b66fb20def (diff) |
Fixes #4912, fix regressions in UsersManager/index.twig that resulted from last seen column addition: do not loop w/ reference when var w/ same name is used below, add extra blank cell for add new user row and remove erroneous condition in LastSeenTimeLogger. Thanks to @tassoman for research into first two issues.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/UsersManager/Controller.php | 6 | ||||
-rw-r--r-- | plugins/UsersManager/LastSeenTimeLogger.php | 4 | ||||
-rw-r--r-- | plugins/UsersManager/javascripts/usersManager.js | 1 |
3 files changed, 5 insertions, 6 deletions
diff --git a/plugins/UsersManager/Controller.php b/plugins/UsersManager/Controller.php index 9f3f8047b4..cd882cfd49 100644 --- a/plugins/UsersManager/Controller.php +++ b/plugins/UsersManager/Controller.php @@ -84,12 +84,12 @@ class Controller extends \Piwik\Plugin\ControllerAdmin $view->showLastSeen = true; $users = APIUsersManager::getInstance()->getUsers(); - foreach ($users as &$user) { + foreach ($users as $index => $user) { $usersAliasByLogin[$user['login']] = $user['alias']; $lastSeen = LastSeenTimeLogger::getLastSeenTimeForUser($user['login']); - $user['last_seen'] = $lastSeen == 0 - ? false : MetricsFormatter::getPrettyTimeFromSeconds(time() - $lastSeen); + $users[$index]['last_seen'] = $lastSeen == 0 + ? false : MetricsFormatter::getPrettyTimeFromSeconds(time() - $lastSeen); } if (Piwik::hasUserSuperUserAccess()) { diff --git a/plugins/UsersManager/LastSeenTimeLogger.php b/plugins/UsersManager/LastSeenTimeLogger.php index 80ae2e4cd6..46d60ad1ca 100644 --- a/plugins/UsersManager/LastSeenTimeLogger.php +++ b/plugins/UsersManager/LastSeenTimeLogger.php @@ -52,9 +52,7 @@ class LastSeenTimeLogger // do not log if last known time is less than N minutes from now (so we don't make too many // queries) - if ($lastSeen == 0 - || time() - $lastSeen <= self::LAST_TIME_SAVE_DELTA - ) { + if (time() - $lastSeen <= self::LAST_TIME_SAVE_DELTA) { return; } diff --git a/plugins/UsersManager/javascripts/usersManager.js b/plugins/UsersManager/javascripts/usersManager.js index e7b0be4a02..cb02bbd46a 100644 --- a/plugins/UsersManager/javascripts/usersManager.js +++ b/plugins/UsersManager/javascripts/usersManager.js @@ -273,6 +273,7 @@ $(document).ready(function () { <td><input id="useradd_email" value="email@domain.com" size="15" /></td>\ <td><input id="useradd_alias" value="alias" size="15" /></td>\ <td>-</td>\ + <td>-</td>\ <td><input type="submit" class="submit adduser" value="' + _pk_translate('General_Save') + '" /></td>\ <td><span class="cancel">' + sprintf(_pk_translate('General_OrCancel'), "", "") + '</span></td>\ </tr>')) |