aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorkevinjardine <kevinjardine@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-25 13:02:54 +0000
committerkevinjardine <kevinjardine@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-25 13:02:54 +0000
commit8eb953ffe12d9d55e9f6c3e6c10e1d19e8477325 (patch)
treee6a69cc7ae810e4253d97a5bf48ca0c86ba32803 /engine/lib
parent6336f2176cf12e195248a96118d5513d79fc652c (diff)
downloadelgg-8eb953ffe12d9d55e9f6c3e6c10e1d19e8477325.tar.gz
elgg-8eb953ffe12d9d55e9f6c3e6c10e1d19e8477325.tar.bz2
Introduces user default access.
git-svn-id: https://code.elgg.org/elgg/trunk@2943 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/access.php20
-rw-r--r--engine/lib/users.php5
2 files changed, 22 insertions, 3 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index eb00d7543..2f9feae43 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -116,13 +116,27 @@
*
* @return int default access id (see ACCESS defines in elgglib.php)
*/
- function get_default_access()
+ function get_default_access($user=null)
{
global $CONFIG;
- // future: if user has a default access set, override site default access
+ if (!$CONFIG->allow_user_default_access) {
+ return $CONFIG->default_access;
+ }
+
+ if (!$user) {
+ if (isloggedin()) {
+ $user = $_SESSION['user'];
+ } else {
+ return $CONFIG->default_access;
+ }
+ }
- return $CONFIG->default_access;
+ if (false !== ($default_access = $user->getPrivateSetting('elgg_default_access'))) {
+ return $default_access;
+ } else {
+ return $CONFIG->default_access;
+ }
}
/**
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 82ba38dde..f7c12bbc9 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1472,6 +1472,10 @@
// Add language settings
extend_elgg_settings_page('user/settings/language', 'usersettings/user', 1);
+
+ // Add default access settings
+ extend_elgg_settings_page('user/settings/default_access', 'usersettings/user', 1);
+
//register_action("user/language");
// Register the user type
@@ -1520,6 +1524,7 @@
@include($CONFIG->path . "actions/user/password.php");
@include($CONFIG->path . "actions/email/save.php");
@include($CONFIG->path . "actions/user/language.php");
+ @include($CONFIG->path . "actions/user/default_access.php");
}