summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-04-28 19:47:45 +0000
committerDries Buytaert <dries@buytaert.net>2010-04-28 19:47:45 +0000
commit114d70db63200267873e00ca6ace42dd3cf4389e (patch)
tree8dc4249ae957605cd0d3219886fe7c67ae3aea80
parent2c83cf581e2763ed694e3fb35dbcb15de7477dda (diff)
downloadbrdo-114d70db63200267873e00ca6ace42dd3cf4389e.tar.gz
brdo-114d70db63200267873e00ca6ace42dd3cf4389e.tar.bz2
- Patch #716718 by joachim, jhodgdon: add notes on security and proper use of user_load() to its function documentation.
-rw-r--r--modules/user/user.module18
1 files changed, 14 insertions, 4 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index 17ee78ae9..3ceb4cf7a 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -273,14 +273,24 @@ class UserController extends DrupalDefaultEntityController {
}
/**
- * Fetch a user object.
+ * Loads a user object.
+ *
+ * Drupal has a global $user object, which represents the currently-logged-in
+ * user. So to avoid confusion and to avoid clobbering the global $user object,
+ * it is a good idea to assign the result of this function to a different local
+ * variable, generally $account. If you actually do want to act as the user you
+ * are loading, it is essential to call @code session_save_session(FALSE);
+ * @endcode first. See @link http://drupal.org/node/218104 Safely impersonating
+ * another user @endlink for more information.
*
* @param $uid
- * Integer specifying the user id.
+ * Integer specifying the user ID to load.
* @param $reset
- * A boolean indicating that the internal cache should be reset.
+ * TRUE to reset the internal cache and load from the database; FALSE
+ * (default) to load from the internal cache, if set.
+ *
* @return
- * A fully-loaded $user object upon successful user load or FALSE if user
+ * A fully-loaded user object upon successful user load, or FALSE if the user
* cannot be loaded.
*
* @see user_load_multiple()