diff options
author | zotlabs <mike@macgirvin.com> | 2018-05-07 17:31:53 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-05-07 17:31:53 -0700 |
commit | aab16123b5188e69b31893263f7074f9e9c7f210 (patch) | |
tree | 846c57ffb6c1d421a6c8147df4ee650f4eb4db84 | |
parent | 1f8b4b14a465193ba0dd061dd55a170e63aeb9ea (diff) | |
download | volse-hubzilla-aab16123b5188e69b31893263f7074f9e9c7f210.tar.gz volse-hubzilla-aab16123b5188e69b31893263f7074f9e9c7f210.tar.bz2 volse-hubzilla-aab16123b5188e69b31893263f7074f9e9c7f210.zip |
Simplify first channel creation even further by using a site-configurable default permissions role and removing one more conceptual roadblock for first time registrants. This default role only applies to the first channel an account creates and can be changed from the settings page once they've started to explore. This functionality was always present but optional and not well exposed. Now it is part of the standard workflow and exposed in the admin settings.
-rw-r--r-- | Zotlabs/Module/Admin/Site.php | 10 | ||||
-rw-r--r-- | Zotlabs/Module/New_channel.php | 25 | ||||
-rw-r--r-- | Zotlabs/Module/Register.php | 4 | ||||
-rwxr-xr-x | view/tpl/admin_site.tpl | 1 | ||||
-rwxr-xr-x | view/tpl/new_channel.tpl | 2 |
5 files changed, 33 insertions, 9 deletions
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 656770ad9..5c35e4a9d 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -77,6 +77,8 @@ class Site { $thumbnail_security = ((x($_POST,'thumbnail_security')) ? intval($_POST['thumbnail_security']) : 0); $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 3000); + $permissions_role = escape_tags(trim($_POST['permissions_role'])); + $techlevel = null; if(array_key_exists('techlevel', $_POST)) $techlevel = intval($_POST['techlevel']); @@ -102,6 +104,7 @@ class Site { set_config('system', 'from_email_name' , $from_email_name); set_config('system', 'imagick_convert_path' , $imagick_path); set_config('system', 'thumbnail_security' , $thumbnail_security); + set_config('system', 'default_permissions_role', $permissions_role); set_config('system', 'techlevel_lock', $techlevel_lock); @@ -286,6 +289,12 @@ class Site { '5' => t('Wizard - I probably know more than you do') ]; + $perm_roles = \Zotlabs\Access\PermissionRoles::roles(); + $default_role = get_config('system','default_permissions_role','social'); + + $role = array('permissions_role' , t('Default permission role for new accounts'), $default_role, t('This role will be used for the first channel created after registration.'),$perm_roles); + + $homelogin = get_config('system','login_on_homepage'); $enable_context_help = get_config('system','enable_context_help'); @@ -321,6 +330,7 @@ class Site { '$minimum_age' => array('minimum_age', t("Minimum age"), (x(get_config('system','minimum_age'))?get_config('system','minimum_age'):13), t("Minimum age (in years) for who may register on this site.")), '$access_policy' => array('access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system','access_policy'), "This is displayed on the public server site list.", $access_choices), '$register_text' => array('register_text', t("Register text"), htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")), + '$role' => $role, '$frontpage' => array('frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system','frontpage'), t("example: 'public' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")), '$mirror_frontpage' => array('mirror_frontpage', t("Preserve site homepage URL"), get_config('system','mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')), '$abandon_days' => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')), diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php index d9becbc22..df7da2fe8 100644 --- a/Zotlabs/Module/New_channel.php +++ b/Zotlabs/Module/New_channel.php @@ -124,7 +124,7 @@ class New_channel extends \Zotlabs\Web\Controller { intval($aid) ); if($r && (! intval($r[0]['total']))) { - $default_role = get_config('system','default_permissions_role'); + $default_role = get_config('system','default_permissions_role','social'); } $limit = account_service_class_fetch(get_account_id(),'total_identities'); @@ -136,21 +136,32 @@ class New_channel extends \Zotlabs\Web\Controller { $channel_usage_message = ''; } } - + + $name_help = (($default_role) + ? t('Your real name is recommended.') + : t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"') + ); + + $nick_help = t('This will be used to create a unique network address (like an email address).'); + + if(! get_config('system','unicode_usernames')) { + $nick_help .= ' ' . t('Allowed characters are a-z 0-9, - and _'); + } + $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); $perm_roles = \Zotlabs\Access\PermissionRoles::roles(); if((get_account_techlevel() < 4) && $privacy_role !== 'custom') unset($perm_roles[t('Other')]); - $name = array('name', t('Name or caption'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"'), "*"); + $name = array('name', t('Channel name'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), $name_help, "*"); $nickhub = '@' . \App::get_hostname(); - $nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), sprintf( t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub), "*"); - $role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/member/member_guide#Channel_Permission_Roles" target="_blank">' . t('Read more about roles') . '</a>',$perm_roles); + $nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), $nick_help, "*"); + $role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel permission role compatible with your usage needs and privacy requirements.') . '<br>' . '<a href="help/member/member_guide#Channel_Permission_Roles" target="_blank">' . t('Read more about channel permission roles') . '</a>',$perm_roles); $o = replace_macros(get_markup_template('new_channel.tpl'), array( - '$title' => t('Create Channel'), - '$desc' => t('A channel is a unique network identity. It can represent a person (social network profile), a forum (group), a business or celebrity page, a newsfeed, and many other things. Channels can make connections with other channels to share information with each other.') . ' ' . t('The type of channel you create affects the basic privacy settings, the permissions that are granted to connections/friends, and also the channel\'s visibility across the network.'), + '$title' => t('Create a Channel'), + '$desc' => t('A channel is a unique network identity. It can represent a person (social network profile), a forum (group), a business or celebrity page, a newsfeed, and many other things.') , '$label_import' => t('or <a href="import">import an existing channel</a> from another location.'), '$name' => $name, '$role' => $role, diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 5356669e9..6bdffd034 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -251,10 +251,10 @@ class Register extends \Zotlabs\Web\Controller { $password = array('password', t('Choose a password'), ''); $password2 = array('password2', t('Please re-enter your password'), ''); $invite_code = array('invite_code', t('Please enter your invitation code'), ((x($_REQUEST,'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : "")); - $name = array('name', t('Name or caption'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"')); + $name = array('name', t('Your Name'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Real names are preferred.')); $nickhub = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl')); $nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), sprintf( t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub)); - $role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/member/member_guide#Account_Permission_Roles" target="_blank">' . t('Read more about roles') . '</a>',$perm_roles); + $role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel permission role for your usage needs and privacy requirements.') . ' <a href="help/member/member_guide#Channel_Permission_Roles" target="_blank">' . t('Read more about channel permission roles') . '</a>',$perm_roles); $tos = array('tos', $label_tos, '', '', array(t('no'),t('yes'))); diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl index 7e99b2c86..ed85bd6b2 100755 --- a/view/tpl/admin_site.tpl +++ b/view/tpl/admin_site.tpl @@ -68,6 +68,7 @@ <h3>{{$registration}}</h3> {{include file="field_input.tpl" field=$register_text}} + {{include file="field_select_grouped.tpl" field=$role}} {{include file="field_select.tpl" field=$register_policy}} {{include file="field_checkbox.tpl" field=$invite_only}} {{include file="field_input.tpl" field=$minimum_age}} diff --git a/view/tpl/new_channel.tpl b/view/tpl/new_channel.tpl index f415e4e2c..a89208228 100755 --- a/view/tpl/new_channel.tpl +++ b/view/tpl/new_channel.tpl @@ -3,6 +3,7 @@ <h2>{{$title}}</h2> </div> <div class="section-content-wrapper"> + {{if ! $default_role}} <div class="section-content-info-wrapper"> {{$desc}} </div> @@ -11,6 +12,7 @@ {{$channel_usage_message}} </div> {{/if}} + {{/if}} <form action="new_channel" method="post" id="newchannel-form"> {{if $default_role}} <input type="hidden" name="permissions_role" value="{{$default_role}}" /> |