diff --git a/include/user.php b/include/user.php index 2d06ef374..282bbdbba 100644 --- a/include/user.php +++ b/include/user.php @@ -277,18 +277,24 @@ function create_user($arr) { 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) - ); - } } } diff --git a/mod/admin.php b/mod/admin.php index db4d4cff2..2d1d21bb4 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -254,7 +254,7 @@ function admin_page_site_post(&$a){ $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); @@ -355,7 +355,7 @@ function admin_page_site_post(&$a){ 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); @@ -467,7 +467,7 @@ function admin_page_site(&$a) { '$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.")), diff --git a/mod/newmember.php b/mod/newmember.php index e17a0db03..8028e7e08 100644 --- a/mod/newmember.php +++ b/mod/newmember.php @@ -69,7 +69,7 @@ function newmember_content(&$a) { $o .= '