summaryrefslogtreecommitdiff
path: root/modules/user
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user')
-rw-r--r--modules/user/user.admin.inc15
-rw-r--r--modules/user/user.module20
2 files changed, 34 insertions, 1 deletions
diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc
index 1cc2c4a24..932c20593 100644
--- a/modules/user/user.admin.inc
+++ b/modules/user/user.admin.inc
@@ -5,6 +5,21 @@
* Admin page callback file for the user module.
*/
+/**
+ * Page callback: Generates the appropriate user administration form.
+ *
+ * This function generates the user registration, multiple user cancellation,
+ * or filtered user list admin form, depending on the argument and the POST
+ * form values.
+ *
+ * @param string $callback_arg
+ * (optional) Indicates which form to build. Defaults to '', which will
+ * trigger the user filter form. If the POST value 'op' is present, this
+ * function uses that value as the callback argument.
+ *
+ * @return string
+ * A renderable form array for the respective request.
+ */
function user_admin($callback_arg = '') {
$op = isset($_POST['op']) ? $_POST['op'] : $callback_arg;
diff --git a/modules/user/user.module b/modules/user/user.module
index 622fe4d25..c1c7ec218 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1517,15 +1517,33 @@ function theme_user_list($variables) {
return theme('item_list', array('items' => $items, 'title' => $title));
}
+/**
+ * Determines if the current user is anonymous.
+ *
+ * @return bool
+ * TRUE if the user is anonymous, FALSE if the user is authenticated.
+ */
function user_is_anonymous() {
// Menu administrators can see items for anonymous when administering.
return !$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']);
}
+/**
+ * Determines if the current user is logged in.
+ *
+ * @return bool
+ * TRUE if the user is logged in, FALSE if the user is anonymous.
+ */
function user_is_logged_in() {
return (bool) $GLOBALS['user']->uid;
}
+/**
+ * Determines if the current user has access to the user registration page.
+ *
+ * @return bool
+ * TRUE if the user is not already logged in and can register for an account.
+ */
function user_register_access() {
return user_is_anonymous() && variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
}
@@ -3353,7 +3371,7 @@ function user_filters() {
$options = array();
foreach (module_implements('permission') as $module) {
$function = $module . '_permission';
- if ($permissions = $function('permission')) {
+ if ($permissions = $function()) {
asort($permissions);
foreach ($permissions as $permission => $description) {
$options[t('@module module', array('@module' => $module))][$permission] = t($permission);