aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-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");
}