aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mod/register.php25
-rw-r--r--view/css/mod_register.css37
-rw-r--r--view/js/mod_register.js21
-rwxr-xr-xview/tpl/register.tpl34
4 files changed, 116 insertions, 1 deletions
diff --git a/mod/register.php b/mod/register.php
index 3a4d5bcb9..853728e10 100644
--- a/mod/register.php
+++ b/mod/register.php
@@ -98,6 +98,14 @@ function register_post(&$a) {
require_once('include/security.php');
+ if($_REQUEST['name'])
+ set_aconfig($result['account']['account_id'],'register','channel_name',$_REQUEST['name']);
+ if($_REQUEST['nickname'])
+ set_aconfig($result['account']['account_id'],'register','channel_address',$_REQUEST['nickname']);
+ if($_REQUEST['permissions_role'])
+ set_aconfig($result['account']['account_id'],'register','permissions_role',$_REQUEST['permissions_role']);
+
+
$using_invites = intval(get_config('system','invitation_only'));
$num_invites = intval(get_config('system','number_invites'));
$invite_code = ((x($_POST,'invite_code')) ? notags(trim($_POST['invite_code'])) : '');
@@ -215,7 +223,12 @@ function register_content(&$a) {
$password = ((x($_REQUEST,'password')) ? trim($_REQUEST['password']) : "" );
$password2 = ((x($_REQUEST,'password2')) ? trim($_REQUEST['password2']) : "" );
$invite_code = ((x($_REQUEST,'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : "" );
+ $name = ((x($_REQUEST,'name')) ? escape_tags(trim($_REQUEST['name'])) : "" );
+ $nickname = ((x($_REQUEST,'nickname')) ? strip_tags(trim($_REQUEST['nickname'])) : "" );
+ $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" );
+ $auto_create = get_config('system','auto_channel_create');
+ $default_role = get_config('system','default_permissions_role');
require_once('include/bbcode.php');
@@ -229,7 +242,17 @@ function register_content(&$a) {
'$invite_desc' => t('Membership on this site is by invitation only.'),
'$label_invite' => t('Please enter your invitation code'),
'$invite_code' => $invite_code,
-
+ '$auto_create' => $auto_create,
+ '$label_name' => t('Channel Name'),
+ '$help_name' => t('Enter your name'),
+ '$label_nick' => t('Choose a short nickname'),
+ '$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'),
+ '$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', '<a href="help/roles" target="_blank">'.t('Read more about roles').'</a>',get_roles()),
+ '$default_role' => $default_role,
+ '$nickname' => $nickname,
+ '$submit' => t('Create'),
'$label_email' => t('Your email address'),
'$label_pass1' => t('Choose a password'),
'$label_pass2' => t('Please re-enter your password'),
diff --git a/view/css/mod_register.css b/view/css/mod_register.css
index 618b7ce95..890a3f76b 100644
--- a/view/css/mod_register.css
+++ b/view/css/mod_register.css
@@ -42,3 +42,40 @@ h2 {
margin-bottom: 20px;
}
+#newchannel-form {
+ font-size: 1.4em;
+ margin-left: 15%;
+ margin-top: 20px;
+ width: 50%;
+}
+
+#newchannel-form .descriptive-paragraph {
+ color: #888;
+ margin-left: 20px;
+ margin-bottom: 25px;
+}
+
+.newchannel-label {
+ float: left;
+ width: 275px;
+}
+
+.newchannel-role-morehelp {
+ float: left;
+ width: 32px;
+}
+.newchannel-input {
+ float: left;
+ width: 275px;
+ padding: 5px;
+}
+
+.newchannel-feedback {
+ float: left;
+ margin-left: 5px;
+}
+
+.newchannel-field-end {
+ clear: both;
+ margin-bottom: 20px;
+}
diff --git a/view/js/mod_register.js b/view/js/mod_register.js
index 95bc7bbbb..8430b4655 100644
--- a/view/js/mod_register.js
+++ b/view/js/mod_register.js
@@ -26,4 +26,25 @@ $(document).ready(function() {
zFormError("#register-password2-feedback", false);
}
});
+
+
+ $("#newchannel-name").blur(function() {
+ $("#name-spinner").spin('small');
+ var zreg_name = $("#newchannel-name").val();
+ $.get("new_channel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) {
+ $("#newchannel-nickname").val(data);
+ zFormError("#newchannel-name-feedback",data.error);
+ $("#name-spinner").spin(false);
+ });
+ });
+ $("#newchannel-nickname").blur(function() {
+ $("#nick-spinner").spin('small');
+ var zreg_nick = $("#newchannel-nickname").val();
+ $.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
+ $("#newchannel-nickname").val(data);
+ zFormError("#newchannel-nickname-feedback",data.error);
+ $("#nick-spinner").spin(false);
+ });
+ });
+
}); \ No newline at end of file
diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl
index 005b122cf..b72e069c3 100755
--- a/view/tpl/register.tpl
+++ b/view/tpl/register.tpl
@@ -22,6 +22,30 @@
<div id="register-invite-end" class="register-field-end"></div>
{{/if}}
+ {{if $auto_create}}
+
+ {{if $default_role}}
+ <input type="hidden" name="permissions_role" value="{{$default_role}}" />
+ {{else}}
+ <div id="newchannel-role-help" class="descriptive-paragraph">{{$help_role}}</div>
+ {{include file="field_select_grouped.tpl" field=$role}}
+ <div id="newchannel-role-end" class="newchannel-field-end"></div>
+ {{/if}}
+
+ <div id="newchannel-name-help" class="descriptive-paragraph">{{$help_name}}</div>
+
+ <label for="newchannel-name" id="label-newchannel-name" class="register-label" >{{$label_name}}</label>
+ <input type="text" name="name" id="newchannel-name" class="register-input" value="{{$name}}" />
+ <div id="name-spinner"></div>
+ <div id="newchannel-name-feedback" class="register-feedback"></div>
+ <div id="newchannel-name-end" class="register-field-end"></div>
+
+
+ {{/if}}
+
+
+
+
<label for="register-email" id="label-register-email" class="register-label" >{{$label_email}}</label>
<input type="text" maxlength="72" size="32" name="email" id="register-email" class="register-input" value="{{$email}}" />
<div id="register-email-feedback" class="register-feedback"></div>
@@ -37,6 +61,16 @@
<div id="register-password2-feedback" class="register-feedback"></div>
<div id="register-password2-end" class="register-field-end"></div>
+ {{if $auto_create}}
+ <div id="newchannel-nick-desc" class="descriptive-paragraph">{{$nick_desc}}</div>
+ <label for="newchannel-nickname" id="label-newchannel-nickname" class="register-label" >{{$label_nick}}</label>
+ <input type="text" name="nickname" id="newchannel-nickname" class="register-input" value="{{$nickname}}" />
+ <div id="nick-spinner"></div>
+ <div id="newchannel-nickname-feedback" class="register-feedback"></div>
+ <div id="newchannel-nickname-end" class="register-field-end"></div>
+
+ {{/if}}
+
{{if $enable_tos}}
<input type="checkbox" name="tos" id="register-tos" value="1" />
<label for="register-tos" id="label-register-tos">{{$label_tos}}</label>