Commit f11ed65f authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow admins to disable T&C agreement on register page; disable for new...


Allow admins to disable T&C agreement on register page; disable for new installs due to default T&C text.
Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent edd88967
......@@ -380,6 +380,13 @@ $siteoptionform = array(
'defaultvalue' => get_config('showonlineuserssideblock'),
'disabled' => in_array('showonlineuserssideblock', $OVERRIDDEN),
),
'registerterms' => array(
'type' => 'checkbox',
'title' => get_string('registerterms', 'admin'),
'description' => get_string('registertermsdescription', 'admin'),
'defaultvalue' => get_config('registerterms'),
'disabled' => in_array('registerterms', $OVERRIDDEN),
),
),
),
)
......@@ -408,7 +415,7 @@ function siteoptions_submit(Pieform $form, $values) {
'showselfsearchsideblock', 'showtagssideblock',
'tagssideblockmaxtags', 'country', 'viewmicroheaders', 'userscanchooseviewthemes',
'remoteavatars', 'userscanhiderealnames', 'antispam', 'spamhaus', 'surbl', 'anonymouscomments',
'homepageinfo', 'showonlineuserssideblock',
'homepageinfo', 'showonlineuserssideblock', 'registerterms',
);
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
......
......@@ -213,6 +213,8 @@ $string['none'] = 'None';
$string['country'] = 'Country';
$string['pathtoclam'] = 'Path to clam';
$string['pathtoclamdescription'] = 'The filesystem path to clamscan or clamdscan';
$string['registerterms'] = 'Registration agreement';
$string['registertermsdescription'] = "Force users to agree to the Terms and Conditions before registration. You should edit your site's Terms and Conditions page before enabling this option.";
$string['remoteavatars'] = 'Display remote avatars';
$string['remoteavatarsdescription'] = 'If checked, the <a href="http://www.gravatar.com">Gravatar</a> service will be used for users\' default profile icons.';
$string['searchplugin'] = 'Search plugin';
......
......@@ -340,7 +340,9 @@ $string['lastnamedescription'] = ' ';
$string['studentid'] = 'ID number';
$string['displayname'] = 'Display name';
$string['fullname'] = 'Full name';
$string['registerstep1description'] = 'Welcome! To use this site you must first register. You must also agree to the <a href="terms.php">terms and conditions</a>. The data we collect here will be stored according to our <a href="privacy.php">privacy statement</a>.';
$string['registerwelcome'] = 'Welcome! To use this site you must first register.';
$string['registeragreeterms'] = 'You must also agree to the <a href="terms.php">terms and conditions</a>.';
$string['registerprivacy'] = 'The data we collect here will be stored according to our <a href="privacy.php">privacy statement</a>.';
$string['registerstep3fieldsoptional'] = '<h3>Choose an Optional Profile Image</h3><p>You have now successfully registered with %s! You may now choose an optional profile icon to be displayed as your avatar.</p>';
$string['registerstep3fieldsmandatory'] = '<h3>Fill Out Mandatory Profile Fields</h3><p>The following fields are required. You must fill them out before your registration is complete.</p>';
$string['registeringdisallowed'] = 'Sorry, you cannot register for this system at this time';
......
......@@ -1751,5 +1751,9 @@ function xmldb_core_upgrade($oldversion=0) {
create_table($table);
}
if ($oldversion < 2010061100) {
set_config('registerterms', 1);
}
return $status;
}
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2010060300;
$config->version = 2010061100;
$config->release = '1.3.0dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
......@@ -223,19 +223,22 @@ else {
die_info(get_string('registeringdisallowed'));
}
$elements['tandc'] = array(
'type' => 'radio',
'title' => get_string('iagreetothetermsandconditions', 'auth.internal'),
'options' => array(
'yes' => get_string('yes'),
'no' => get_string('no')
),
'defaultvalue' => 'no',
'rules' => array(
'required' => true
),
'separator' => ' &nbsp; '
);
$registerterms = get_config('registerterms');
if ($registerterms) {
$elements['tandc'] = array(
'type' => 'radio',
'title' => get_string('iagreetothetermsandconditions', 'auth.internal'),
'options' => array(
'yes' => get_string('yes'),
'no' => get_string('no')
),
'defaultvalue' => 'no',
'rules' => array(
'required' => true
),
'separator' => ' &nbsp; '
);
}
$elements['submit'] = array(
'type' => 'submit',
......@@ -272,7 +275,7 @@ $form = array(
* can guarantee that the auth method is internal
*/
function register_validate(Pieform $form, $values) {
global $SESSION;
global $SESSION, $registerterms;
$spamtrap = new_spam_trap(array(
array(
......@@ -320,7 +323,7 @@ function register_validate(Pieform $form, $values) {
}
// If the user hasn't agreed to the terms and conditions, don't bother
if ($values['tandc'] != 'yes') {
if ($registerterms && $values['tandc'] != 'yes') {
$form->set_error('tandc', get_string('youmaynotregisterwithouttandc', 'auth.internal'));
}
......@@ -382,9 +385,18 @@ function register_submit(Pieform $form, $values) {
redirect('/register.php');
}
$registerdescription = get_string('registerwelcome');
if ($registerterms) {
$registerdescription .= ' ' . get_string('registeragreeterms');
}
$registerdescription .= ' ' . get_string('registerprivacy');
$smarty = smarty();
$smarty->assign('register_form', pieform($form));
$smarty->assign('termsandconditions', get_site_page_content('termsandconditions'));
$smarty->assign('registerdescription', $registerdescription);
if ($registerterms) {
$smarty->assign('termsandconditions', get_site_page_content('termsandconditions'));
}
$smarty->assign('PAGEHEADING', hsc(get_string('register')));
$smarty->display('register.tpl');
......
{auto_escape off}
{include file="header.tpl"}
{if $register_form}
<p>{str tag=registerstep1description}</P>
<p>{$registerdescription}</P>
{$register_form}
{if $termsandconditions}<br><br><div>{$termsandconditions}</div>{/if}
......
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