require_once('include/group.php');
group_add($newuid, t('Friends'));
- if(! get_config('system', 'newuser_public')) {
- $r = q("SELECT id FROM `group` WHERE uid = %d AND name = '%s'",
- intval($newuid),
- dbesc(t('Friends'))
+ $r = q("SELECT id FROM `group` WHERE uid = %d AND name = '%s'",
+ intval($newuid),
+ dbesc(t('Friends'))
+ );
+ if($r && count($r)) {
+ $def_gid = $r[0]['id'];
+
+ q("UPDATE user SET def_gid = %d WHERE uid = %d",
+ intval($r[0]['id']),
+ intval($newuid)
+ );
+ }
+
+ if(get_config('system', 'newuser_private') && $def_gid) {
+ q("UPDATE user SET allow_gid = '%s' WHERE uid = %d",
+ dbesc("<" . $def_gid . ">"),
+ intval($newuid)
);
- if($r) {
- q("UPDATE user SET def_gid = %d, allow_gid = '%s' WHERE uid = %d",
- intval($r[0]['id']),
- dbesc("<" . $r[0]['id'] . ">"),
- intval($newuid)
- );
- }
}
}
$force_publish = ((x($_POST,'publish_all')) ? True : False);
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
$thread_allow = ((x($_POST,'thread_allow')) ? True : False);
- $newuser_public = ((x($_POST,'newuser_public')) ? True : False);
+ $newuser_private = ((x($_POST,'newuser_private')) ? True : False);
$no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False);
$no_openid = !((x($_POST,'no_openid')) ? True : False);
$no_regfullname = !((x($_POST,'no_regfullname')) ? True : False);
set_config('system','directory_submit_url', $global_directory);
}
set_config('system','thread_allow', $thread_allow);
- set_config('system','newuser_public', $newuser_public);
+ set_config('system','newuser_private', $newuser_private;
set_config('system','block_extended_register', $no_multi_reg);
set_config('system','no_openid', $no_openid);
'$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")),
'$global_directory' => array('directory_submit_url', t("Global directory update URL"), get_config('system','directory_submit_url'), t("URL to update the global directory. If this is not set, the global directory is completely unavailable to the application.")),
'$thread_allow' => array('thread_allow', t("Allow threaded items"), get_config('system','thread_allow'), t("Allow infinite level threading for items on this site.")),
- '$newuser_public' => array('newuser_public', t("No default permissions for new users"), get_config('system','newuser_public'), t("New users will have no private permissions set for their posts by default, making their posts public until they change it.")),
+ '$newuser_private' => array('newuser_private', t("Private posts by default for new users"), get_config('system','newuser_private'), t("Set default post permissions for all new members to the default privacy group rather than public.")),
'$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")),
'$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")),