aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php39
1 files changed, 36 insertions, 3 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 66696ea07..252464d20 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -541,7 +541,7 @@
}
-/**
+ /**
* Obtains a list of objects owned by a user's friends
*
* @param int $user_guid The GUID of the user to get the friends of
@@ -771,8 +771,10 @@
$offset = (int)$offset;
$time = time() - $seconds;
+
+ $access = get_access_sql_suffix("e");
- $query = "SELECT distinct e.* from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}users_entity u on e.guid = u.guid where u.last_action >= {$time} order by u.last_action desc limit {$offset},{$limit}";
+ $query = "SELECT distinct e.* from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}users_entity u on e.guid = u.guid where u.last_action >= {$time} and $access order by u.last_action desc limit {$offset},{$limit}";
return get_data($query, "entity_row_to_elggstar");
}
@@ -1154,6 +1156,33 @@
$time = time();
update_data("update {$CONFIG->dbprefix}users_entity set prev_last_action = last_action, last_action = {$time} where guid = {$user_guid}");
+ }
+
+ /**
+ * A permissions plugin hook that grants access to users if they are newly created - allows
+ * for email activation.
+ *
+ * TODO: Do this in a better way!
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ */
+ function new_user_enable_permissions_check($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $user = $params['user'];
+ if (($entity) && ($entity instanceof ElggUser))
+ {
+ if (
+ (($entity->disable_reason == 'new_user') || (
+ $entity->last_action == 0 && $entity->last_login == 0
+ ))
+ && (!isloggedin()))
+ return true;
+
+ }
}
/**
@@ -1228,7 +1257,11 @@
register_plugin_hook('usersettings:save','user','users_settings_save');
register_plugin_hook('search','all','search_list_users_by_name');
-
+
+
+ // Handle a special case for newly created users when the user is not logged in
+ // TODO: handle this better!
+ //register_plugin_hook('permissions_check','user','new_user_enable_permissions_check');
}
/**