mirror of https://github.com/BOINC/boinc.git
Merge pull request #2539 from drshawnkwang/drupal_fix_termsofuse-wording
Drupal: Changed wording of terms-of-use page.
This commit is contained in:
commit
a310795ecb
|
@ -350,7 +350,7 @@ function boincuser_admin_weboptions(&$form_state) {
|
|||
'#type' => 'checkbox',
|
||||
'#title' => t('Enable create_account.php RPC'),
|
||||
'#default_value' => $default['boinc_weboptions_enableaccountcreateRPC'],
|
||||
'#description' => t('If checked, users will be able to create an account remotely using the create_account.php RPC. This option is independent of the user regsitration option found in ') . l(t('User management -> User settings'), '/admin/user/settings') . '. If enabled, user <b>may not be able to opt-in</b> to your site\'s privacy and data retention policies!',
|
||||
'#description' => t('If checked, users will be able to create an account remotely using the create_account.php RPC. This option is independent of the user regsitration option found in ') . l(t('User management -> User settings'), '/admin/user/settings') . '. If enabled, user <b>may not be able to see and agree to the terms-of-use</b> to your site\'s privacy and data retention policies!',
|
||||
);
|
||||
|
||||
$form['boinc_weboptions_registrationtitle'] = array(
|
||||
|
@ -378,7 +378,7 @@ function boincuser_admin_weboptions(&$form_state) {
|
|||
|
||||
$form['boinc_weboptions_agreequestion'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Terms of use opt-in question'),
|
||||
'#title' => t('Terms of use agreement question'),
|
||||
'#description' => t('This text is presented to the user as the question next to the \'I agree\' checkbox.'),
|
||||
'#default_value' => $default['boinc_weboptions_agreequestion'],
|
||||
);
|
||||
|
|
|
@ -130,11 +130,11 @@ function boincuser_menu() {
|
|||
'access arguments' => array('access content'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
$items['user/optin'] = array(
|
||||
'title' => bts('Opt In to Terms of Use', array(), NULL, 'boinc:opt-in-form'),
|
||||
'description' => 'Opt-in to site\'s term of use.',
|
||||
$items['user/termsofuse'] = array(
|
||||
'title' => bts('Terms of Use', array(), NULL, 'boinc:termsofuse-form'),
|
||||
'description' => 'A site\'s term of use.',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('boincuser_optinform'),
|
||||
'page arguments' => array('boincuser_termsofuse_form'),
|
||||
'access callback' => 'user_is_logged_in',
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
|
@ -229,7 +229,7 @@ function boincuser_init() {
|
|||
boincteam_show_messages();
|
||||
}
|
||||
|
||||
// Check if user has opt-in to the terms of use. If not, send the
|
||||
// Check if user has agreed to the terms of use. If not, send the
|
||||
// user to the terms-of-use form. This is only makes sense if the
|
||||
// termsofuse is enabled, by having text in the termsofuse variable.
|
||||
$termsofuse = variable_get('boinc_weboptions_termsofuse', '');
|
||||
|
@ -246,7 +246,7 @@ function boincuser_init() {
|
|||
// @todo - replace this static array with one that allows
|
||||
// admins to specify custom paths (patterns) to ignore.
|
||||
$paths_to_ignore = array(
|
||||
'user/optin',
|
||||
'user/termsofuse',
|
||||
'logout',
|
||||
'privacy',
|
||||
'moderation',
|
||||
|
@ -256,7 +256,7 @@ function boincuser_init() {
|
|||
$paths_to_ignore[] = 'user/' . $user->uid . '/deleteconfirm/*';
|
||||
}
|
||||
if (!_boincuser_ignore_paths($path, $paths_to_ignore)) {
|
||||
drupal_goto('user/optin');
|
||||
drupal_goto('user/termsofuse');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ function boincuser_user($op, &$edit, &$account, $category = NULL) {
|
|||
return;
|
||||
}
|
||||
|
||||
// if terms of use exist, the user must have opted-in.
|
||||
// if terms of use exist, the user must agree.
|
||||
$termsofuse = variable_get('boinc_weboptions_termsofuse', '');
|
||||
if (!empty($termsofuse)) {
|
||||
$reference2 = boincuser_consentto_termsofuse($account);
|
||||
|
@ -495,7 +495,7 @@ function boincuser_user($op, &$edit, &$account, $category = NULL) {
|
|||
|
||||
/**
|
||||
* Implementation of hook_user_login(); When user-logins, checks if
|
||||
* they have opt-in to the terms of use.
|
||||
* they have agreed to the terms of use.
|
||||
*(forward compatible to Drupal 7).
|
||||
*/
|
||||
function boincuser_user_login(&$edit, $account) {
|
||||
|
@ -509,7 +509,7 @@ function boincuser_user_login(&$edit, $account) {
|
|||
|
||||
// Find and save the current destination and use as an parameter
|
||||
// to send the user back to here he/she came from.
|
||||
$np = ltrim('user/optin', '/');
|
||||
$np = ltrim('user/termsofuse', '/');
|
||||
$path_for_destination = rawurlencode($np);
|
||||
|
||||
$query_for_destination = '';
|
||||
|
@ -1090,7 +1090,7 @@ function boincuser_form_alter(&$form, $form_state, $form_id) {
|
|||
'#suffix' => '</div>',
|
||||
);
|
||||
|
||||
$form['optin'] = array(
|
||||
$form['agreeTOU'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'),
|
||||
'#weight' => -8,
|
||||
|
|
|
@ -101,11 +101,11 @@ function boincuser_register_validate($form, &$form_state) {
|
|||
// Include BOINC database objects library
|
||||
require_boinc('boinc_db');
|
||||
|
||||
// Check opt-in
|
||||
// Check terms of use agreement
|
||||
$termsofuse = variable_get('boinc_weboptions_termsofuse', '');
|
||||
if (!empty($termsofuse)) {
|
||||
if (!$form_state['values']['optin']) {
|
||||
form_set_error('optin', bts('ERROR: You must acknowledge our terms of use by clicking the checkbox before registering for an account.', NULL, 'boinc:register-new-user'));
|
||||
if (!$form_state['values']['agreeTOU']) {
|
||||
form_set_error('termsofuse', bts('ERROR: You must acknowledge our terms of use by clicking the checkbox before registering for an account.', NULL, 'boinc:register-new-user'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -646,10 +646,10 @@ function boincuser_fix_unfriend_form_submit($form, &$form_state) {
|
|||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Opt-in to terms of use form
|
||||
* The terms of use form
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
function boincuser_optinform() {
|
||||
function boincuser_termsofuse_form() {
|
||||
global $user;
|
||||
|
||||
// If user has already signed terms of use, and got to this form in error, send them to site home.
|
||||
|
@ -657,7 +657,7 @@ function boincuser_optinform() {
|
|||
drupal_goto();
|
||||
}
|
||||
|
||||
drupal_set_message( bts('WARNING: You have not opted-in to our terms of use. Please opt-in to the terms of use before continuing.', array(), NULL, 'boinc:opt-in-form'), 'warning' );
|
||||
drupal_set_message( bts('WARNING: You have not agreed to our terms of use. Please agree to the terms of use before continuing.', array(), NULL, 'boinc:termsofuse-form'), 'warning' );
|
||||
|
||||
$form = array();
|
||||
|
||||
|
@ -677,7 +677,7 @@ function boincuser_optinform() {
|
|||
'#suffix' => '</div>',
|
||||
);
|
||||
|
||||
$form['optin'] = array(
|
||||
$form['agreeTOU'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'),
|
||||
'#weight' => -8,
|
||||
|
@ -695,7 +695,7 @@ function boincuser_optinform() {
|
|||
$form['submit'] = array(
|
||||
'#prefix' => '<p><p><p><li class="first tab">',
|
||||
'#type' => 'submit',
|
||||
'#value' => bts('Yes', array(), NULL, 'boinc:opt-in-form'),
|
||||
'#value' => bts('Yes', array(), NULL, 'boinc:termsofuse-form'),
|
||||
'#suffix' => '</li>',
|
||||
);
|
||||
$form['form control tabs'] = array(
|
||||
|
@ -715,17 +715,17 @@ function boincuser_optinform() {
|
|||
return $form;
|
||||
}
|
||||
|
||||
function boincuser_optinform_validate($form, &$form_state) {
|
||||
// Check opt-in
|
||||
if (!$form_state['values']['optin']) {
|
||||
form_set_error('legaloptin', bts('ERROR: You must acknowledge our terms of use by clicking the checkbox before registering for an account.', array(), NULL, 'boinc:opt-in-form'));
|
||||
function boincuser_termsofuse_form_validate($form, &$form_state) {
|
||||
// Check TOU agreement
|
||||
if (!$form_state['values']['agreeTOU']) {
|
||||
form_set_error('termsofuse', bts('ERROR: You must acknowledge our terms of use by clicking the checkbox before registering for an account.', array(), NULL, 'boinc:termsofuse-form'));
|
||||
}
|
||||
}
|
||||
|
||||
function boincuser_optinform_submit($form, &$form_state) {
|
||||
function boincuser_termsofuse_form_submit($form, &$form_state) {
|
||||
$user = $form['#account'];
|
||||
if (!boincuser_consentto_termsofuse($user)) {
|
||||
form_set_error('legaloptin', bts('There was an error in the opt-in process. Please contact the site administrators.', array(), NULL, 'boinc:opt-in-form'));
|
||||
form_set_error('termsofuse', bts('There was an error in agreeing to the terms of use. Please contact the site administrators.', array(), NULL, 'boinc:termsofuse-form'));
|
||||
}
|
||||
|
||||
// Delete session messages
|
||||
|
|
|
@ -235,9 +235,9 @@ function create_proper_drupalname($requested_name) {
|
|||
|
||||
|
||||
/**
|
||||
* Determine if user has opted-in to the terms of use. If not, the
|
||||
* user must opt-in first. Returns TRUE/FALSE depending on database
|
||||
* record.
|
||||
* Determine if user has agreed to the terms of use. If not, the user
|
||||
* must agree to terms of use. Returns TRUE/FALSE depending on
|
||||
* database record.
|
||||
*
|
||||
* @params object $user
|
||||
* This is a drupal user object.
|
||||
|
@ -248,10 +248,9 @@ function boincuser_check_termsofuse($user) {
|
|||
// project's user table, which does not exist, but may be added
|
||||
// upstream. If/when that occurs, check it here.
|
||||
$qres = db_query('SELECT bu.privacy_consent_dt FROM {boincuser} AS bu WHERE uid=%d', $user->uid);
|
||||
$optin_dt = db_result($qres);
|
||||
// If datetime the user opted-in is larger than the current
|
||||
// unixtime, then the check passes.
|
||||
if ($optin_dt > 1 ) {
|
||||
$consent_dt = db_result($qres);
|
||||
// Check datetime of consent, it should not be zero.
|
||||
if ($consent_dt > 1 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -268,7 +267,7 @@ function boincuser_check_termsofuse($user) {
|
|||
function boincuser_consentto_termsofuse($user) {
|
||||
$uid = $user->uid;
|
||||
|
||||
// @todo - Modify BOINC project database user table to record opt-in datetime.
|
||||
// @todo - Modify BOINC project database to record consent.
|
||||
$sql = 'UPDATE {boincuser} set privacy_consent_dt = %d WHERE uid=%d';
|
||||
$qrc = db_query($sql, time(), $uid);
|
||||
return $qrc;
|
||||
|
|
Loading…
Reference in New Issue