summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Miles2010-03-11 01:23:39 (GMT)
committer Earl Miles2010-03-11 01:23:39 (GMT)
commit95eb9e83b298183e4ea981c4600d3d4fef377696 (patch)
tree3a4043900c7b5f71f676b2eba06820b9caeb59ad
parenta703bd760af7fdb53a21f53da739148972914f02 (diff)
#662654 by dereine: Do not use query to load/validate a user if the user happens to be the logged in user.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--modules/user/views_plugin_argument_validate_user.inc12
2 files changed, 11 insertions, 2 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index a3218c6..0d804f2 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -39,6 +39,7 @@ Views 2.x-dev
o #638004 by stBorchert and BillyMG: If a field "Output as link" ends up with an empty path, do not actually print an empty link.
o #657384 by smoothify: Under rare circumstances, date default argument could get wrong value.
o #658842 by tomgf: Provide a proper ellipsis instead of "...".
+ o #662654 by dereine: Do not use query to load/validate a user if the user happens to be the logged in user.
Other changes:
o #570558 by yhahn: Segment default views caching to conserve memory used by Views during normal operation.
diff --git a/modules/user/views_plugin_argument_validate_user.inc b/modules/user/views_plugin_argument_validate_user.inc
index 675bd13..06c901b 100644
--- a/modules/user/views_plugin_argument_validate_user.inc
+++ b/modules/user/views_plugin_argument_validate_user.inc
@@ -63,11 +63,17 @@ class views_plugin_argument_validate_user extends views_plugin_argument_validate
// However, is_integer() will always fail, since $argument is a string.
if (is_numeric($argument) && $argument == (int)$argument) {
if ($type == 'uid' || $type == 'either') {
+ if ($argument == $GLOBALS['user']->uid) {
+ $account = $GLOBALS['user'];
+ }
$where = 'uid = %d';
}
}
else {
if ($type == 'name' || $type == 'either') {
+ if ($argument == $GLOBALS['user']->name) {
+ $account = $GLOBALS['user'];
+ }
$where = "name = '%s'";
}
}
@@ -77,8 +83,10 @@ class views_plugin_argument_validate_user extends views_plugin_argument_validate
return FALSE;
}
- $query = "SELECT uid, name FROM {users} WHERE $where";
- $account = db_fetch_object(db_query($query, $argument));
+ if (!isset($account)) {
+ $query = "SELECT uid, name FROM {users} WHERE $where";
+ $account = db_fetch_object(db_query($query, $argument));
+ }
if (empty($account)) {
// User not found.
return FALSE;