diff --git a/doc/hidden_configs.bb b/doc/hidden_configs.bb index 8a02a23f2..39ec9569d 100644 --- a/doc/hidden_configs.bb +++ b/doc/hidden_configs.bb @@ -65,6 +65,10 @@ This document assumes you're an administrator. this website. Can be overwritten by user settings. [b]system > projecthome[/b] Set the project homepage as the homepage of your hub. + [b]system > default_permissions_role[/b] + If set to a valid permissions role name (for instance 'public'), use that role for + the first channel created by a new account and don't ask for the "Channel Type" on + the channel creation form. [b]system > workflow_channel_next[/b] The page to direct users to immediately after creating a channel. [b]system > max_daily_registrations[/b] diff --git a/mod/new_channel.php b/mod/new_channel.php index 047048f0a..bec2a3c09 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -100,6 +100,17 @@ function new_channel_content(&$a) { return; } + $default_role = ''; + $aid = get_account_id(); + if($aid) { + $r = q("select count(channel_id) as total from channel where channel_account_id = %d", + intval($aid) + ); + if($r && (! intval($r[0]['total']))) { + $default_role = get_config('system','default_permissions_role'); + } + } + $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); @@ -117,6 +128,7 @@ function new_channel_content(&$a) { '$name' => $name, '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'), '$role' => array('permissions_role' , t('Channel Type'), ($privacy_role) ? $privacy_role : 'social', ''.t('Read more about roles').'',get_roles()), + '$default_role' => $default_role, '$nickname' => $nickname, '$submit' => t('Create') )); diff --git a/view/tpl/new_channel.tpl b/view/tpl/new_channel.tpl index f78a3fc2d..46b32b8a9 100755 --- a/view/tpl/new_channel.tpl +++ b/view/tpl/new_channel.tpl @@ -5,10 +5,13 @@
{{$desc}}
-
{{$help_role}}
- {{include file="field_select_grouped.tpl" field=$role}} -
- + {{if $default_role}} + + {{else}} +
{{$help_role}}
+ {{include file="field_select_grouped.tpl" field=$role}} +
+ {{/if}}