diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-13 18:06:07 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-13 18:06:07 +0000 |
commit | 0b6489397a8f5a01c28e61d07548e99ef3e4ff6a (patch) | |
tree | fcce8e6e2390169727a80ded32d754b15dd468f7 /engine/lib/users.php | |
parent | fa67f02d3979211ad1553d7901d2cc104b0b0539 (diff) | |
download | elgg-0b6489397a8f5a01c28e61d07548e99ef3e4ff6a.tar.gz elgg-0b6489397a8f5a01c28e61d07548e99ef3e4ff6a.tar.bz2 |
Reverted changes so users can now register again.
There are critical issues with enable/disable.
Primarily:
1) A number of functions do not use the access controls, these throw an exception when accessing a disabled entity.
2) #243 does not seem possible.
git-svn-id: https://code.elgg.org/elgg/trunk@1909 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r-- | engine/lib/users.php | 39 |
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');
}
/**
|