From b5d785ab9ad049b9db1b4ee1d50cc385a40eafa7 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 7 Jul 2008 19:56:56 +0000 Subject: Administration tweaks; fixed users online functions, as well as last_action functions, and the 'make admin' functionality git-svn-id: https://code.elgg.org/elgg/trunk@1326 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/users.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'engine/lib/users.php') diff --git a/engine/lib/users.php b/engine/lib/users.php index cec5c87c7..229735960 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -769,8 +769,7 @@ $time = time() - $seconds; - //$query = "SELECT * from {$CONFIG->dbprefix}entities where type='user' and time_updated>=$time order by time_updated desc limit $offset, $limit"; - $query = "SELECT distinct e.* from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}system_log s on e.guid=s.performed_by_guid where e.type='user' and s.time_created>=$time order by s.time_created 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} order by u.last_action desc limit {$offset},{$limit}"; return get_data($query, "entity_row_to_elggstar"); } @@ -939,6 +938,20 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/friends/of.php"); } + + /** + * Sets the last action time of the given user to right now. + * + * @param int $user_guid The user GUID + */ + function set_last_action($user_guid) { + + $user_guid = (int) $user_guid; + global $CONFIG; + $time = time(); + update_data("update {$CONFIG->dbprefix}users_entity set prev_last_action = last_action, last_action = {$time} where guid = {$user_guid}"); + + } /** * Users initialisation function, which establishes the page handler -- cgit v1.2.3