From 32d4a359f1bc713b37f47d1d2a5e1f47d8ca6501 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 13 Sep 2012 19:11:07 -0700 Subject: [PATCH] reverse the default newuser privacy setting to public. Sites can over-ride. --- include/user.php | 28 ++++++++++++++++---------- mod/admin.php | 6 +++--- mod/newmember.php | 2 +- view/admin_site.tpl | 2 +- view/theme/frost-mobile/admin_site.tpl | 2 +- view/theme/frost/admin_site.tpl | 2 +- 6 files changed, 24 insertions(+), 18 deletions(-) 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 .= '
  • ' . '' . t('Group Your Contacts') . '
    ' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '
  • ' . EOL; - if(! get_config('system', 'newuser_public')) { + if(get_config('system', 'newuser_private')) { $o .= '
  • ' . '' . t("Why Aren't My Posts Public?") . '
    ' . t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '
  • ' . EOL; } diff --git a/view/admin_site.tpl b/view/admin_site.tpl index 6564565f7..ceba97d3f 100644 --- a/view/admin_site.tpl +++ b/view/admin_site.tpl @@ -76,7 +76,7 @@ {{ inc field_checkbox.tpl with $field=$dfrn_only }}{{ endinc }} {{ inc field_input.tpl with $field=$global_directory }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }} - {{ inc field_checkbox.tpl with $field=$newuser_public }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$newuser_private }}{{ endinc }}
    diff --git a/view/theme/frost-mobile/admin_site.tpl b/view/theme/frost-mobile/admin_site.tpl index 91aeda035..087de4f7d 100644 --- a/view/theme/frost-mobile/admin_site.tpl +++ b/view/theme/frost-mobile/admin_site.tpl @@ -40,7 +40,7 @@ {{ inc field_checkbox.tpl with $field=$dfrn_only }}{{ endinc }} {{ inc field_input.tpl with $field=$global_directory }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }} - {{ inc field_checkbox.tpl with $field=$newuser_public }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$newuser_private }}{{ endinc }}
    diff --git a/view/theme/frost/admin_site.tpl b/view/theme/frost/admin_site.tpl index 91aeda035..087de4f7d 100644 --- a/view/theme/frost/admin_site.tpl +++ b/view/theme/frost/admin_site.tpl @@ -40,7 +40,7 @@ {{ inc field_checkbox.tpl with $field=$dfrn_only }}{{ endinc }} {{ inc field_input.tpl with $field=$global_directory }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }} - {{ inc field_checkbox.tpl with $field=$newuser_public }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$newuser_private }}{{ endinc }}