Commit bc8b48cc by Scott Vivian

Add T&C checkbox to register page

parent cd625221
......@@ -128,6 +128,7 @@
'send_reset_button' => 'Send Reset Password Email',
'send_reset_note' => 'A message will be sent to your email address with instructions.',
'special_users' => 'Special users',
'terms_not_accepted' => 'You must tick this.',
'unblock_user_button' => 'Unblock User',
'unsubscribe_complete' => 'You have been unsubscribed from mass mailings sent out by ^0. You may resubscribe at any time via your ^1account^2 page.',
'unsubscribe_title' => 'Unsubscribe',
......
......@@ -80,6 +80,7 @@
$inemail = qa_post_text('email');
$inpassword = qa_post_text('password');
$inhandle = qa_post_text('handle');
$interms = (int) qa_post_text('terms');
$inprofile = array();
foreach ($userfields as $userfield)
......@@ -94,6 +95,9 @@
qa_password_validate($inpassword)
);
if (!$interms)
$errors['terms'] = qa_lang_html('users/terms_not_accepted');
if (count($inprofile)) {
$filtermodules = qa_load_modules_with('filter', 'filter_profile');
foreach ($filtermodules as $filtermodule)
......@@ -137,19 +141,12 @@
$qa_content['error'] = @$pageerror;
$custom = qa_opt('show_custom_register') ? trim(qa_opt('custom_register')) : '';
$qa_content['form'] = array(
'tags' => 'method="post" action="'.qa_self_html().'"',
'style' => 'tall',
'fields' => array(
'custom' => array(
'type' => 'custom',
'note' => $custom,
),
'handle' => array(
'label' => qa_lang_html('users/handle_label'),
'tags' => 'name="handle" id="handle"',
......@@ -187,8 +184,26 @@
),
);
if (!strlen($custom))
unset($qa_content['form']['fields']['custom']);
// prepend custom message
$custom = qa_opt('show_custom_register') ? trim(qa_opt('custom_register')) : '';
if (strlen($custom)) {
array_unshift($qa_content['form']['fields'], array(
'type' => 'custom',
'note' => $custom,
));
}
// show terms/conditions checkbox
$terms = qa_opt('show_register_terms') ? trim(qa_opt('register_terms')) : '';
if (strlen($terms)) {
$qa_content['form']['fields']['terms'] = array(
'type' => 'checkbox',
'label' => $terms,
'tags' => 'name="terms" id="terms"',
'value' => qa_html(@$interms),
'error' => qa_html(@$errors['terms']),
);
}
foreach ($userfields as $userfield) {
$value = @$inprofile[$userfield['fieldid']];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment