Provide the ability for a hub admin to specify a default permissions role for the first channel created by a new account. This simplifies channel creation by restricting the available options at registration time. The restriction is not applied to any additional channels created under the same account; and in any event can be changed immediately after channel creation, if desired.
This commit is contained in:
parent
1ad90b8662
commit
5b0a17359d
@ -65,6 +65,10 @@ This document assumes you're an administrator.
|
|||||||
this website. Can be overwritten by user settings.
|
this website. Can be overwritten by user settings.
|
||||||
[b]system > projecthome[/b]
|
[b]system > projecthome[/b]
|
||||||
Set the project homepage as the homepage of your hub.
|
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]
|
[b]system > workflow_channel_next[/b]
|
||||||
The page to direct users to immediately after creating a channel.
|
The page to direct users to immediately after creating a channel.
|
||||||
[b]system > max_daily_registrations[/b]
|
[b]system > max_daily_registrations[/b]
|
||||||
|
@ -100,6 +100,17 @@ function new_channel_content(&$a) {
|
|||||||
return;
|
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'] : "" );
|
$name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" );
|
||||||
$nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" );
|
$nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" );
|
||||||
$privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" );
|
$privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" );
|
||||||
@ -117,6 +128,7 @@ function new_channel_content(&$a) {
|
|||||||
'$name' => $name,
|
'$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'),
|
'$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', '<a href="help/roles" target="_blank">'.t('Read more about roles').'</a>',get_roles()),
|
'$role' => array('permissions_role' , t('Channel Type'), ($privacy_role) ? $privacy_role : 'social', '<a href="help/roles" target="_blank">'.t('Read more about roles').'</a>',get_roles()),
|
||||||
|
'$default_role' => $default_role,
|
||||||
'$nickname' => $nickname,
|
'$nickname' => $nickname,
|
||||||
'$submit' => t('Create')
|
'$submit' => t('Create')
|
||||||
));
|
));
|
||||||
|
@ -5,10 +5,13 @@
|
|||||||
|
|
||||||
<div id="newchannel-desc" class="descriptive-paragraph">{{$desc}}</div>
|
<div id="newchannel-desc" class="descriptive-paragraph">{{$desc}}</div>
|
||||||
|
|
||||||
|
{{if $default_role}}
|
||||||
|
<input type="hidden" name="permissions_role" value="{{$default_role}}" />
|
||||||
|
{{else}}
|
||||||
<div id="newchannel-role-help" class="descriptive-paragraph">{{$help_role}}</div>
|
<div id="newchannel-role-help" class="descriptive-paragraph">{{$help_role}}</div>
|
||||||
{{include file="field_select_grouped.tpl" field=$role}}
|
{{include file="field_select_grouped.tpl" field=$role}}
|
||||||
<div id="newchannel-role-end" class="newchannel-field-end"></div>
|
<div id="newchannel-role-end" class="newchannel-field-end"></div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<label for="newchannel-name" id="label-newchannel-name" class="newchannel-label" >{{$label_name}}</label>
|
<label for="newchannel-name" id="label-newchannel-name" class="newchannel-label" >{{$label_name}}</label>
|
||||||
<input type="text" name="name" id="newchannel-name" class="newchannel-input" value="{{$name}}" />
|
<input type="text" name="name" id="newchannel-name" class="newchannel-input" value="{{$name}}" />
|
||||||
|
Reference in New Issue
Block a user