For Drupal 6.x is there a module that makes it a requirement that the user check a check box before logging in?
The site needs to require every user to accept the Terms and Conditions at each login, not just at registration.
Webmasters Stack Exchange is a question and answer site for webmasters. It only takes a minute to sign up.
Sign up to join this communityThere are two modules, http://drupal.org/project/legal and http://drupal.org/project/terms_of_use, that require you to accept on registration (I guess you found those already).
What you need (accept on every login) is not a feature of those modules, as far as I know. However I think that is should not be too hard to write a custom module, re-using some of the code of one of those modules, that adds this checkbox to every login form.
If you have not written modules before, check out the module developer's guide on drupal.org. You will have to use hook_form_alter to add a checkbox to the login form.
@marcvangend thank you for the info and links, here is the code I found/edited/came up with:
function toscheckbox_form_user_login_alter(&$form, &$form_state) {
// Add a checkbox to login form about agreeing to terms of service.
$form['terms_of_service'] = array(
'#type' => 'checkbox',
'#title' => "I agree with the website's terms of service.",
'#required' => TRUE
);
}
function toscheckbox_form_user_login_block_alter(&$form, &$form_state) {
// Add a checkbox to login form about agreeing to terms of service.
$form['terms_of_service'] = array(
'#type' => 'checkbox',
'#title' => "I agree with the website's terms of service.",
'#required' => TRUE
);
}
'#required' => TRUE
will only check if a valid value has been entered. For a checkbox, both 1 and 0 are valid values, so an unchecked box would still pass the #required test.
Nov 20, 2010 at 16:11
Even easier, when they log in, redirect them to a page that contains a little javascript.
Like so:
1) Create this trigger/action set: [Trigger] User Logs In -> [Action] Redirect to /mustagree
2) Add content page mustagree:
if ( confirm('Terms: \n You must be older than 18 to enter. \n \n Do you agree to these terms?') ) { window.location = 'userhomepage' } else { window.location = 'logout' }Assuming you have a content page with the url userhomepage this will work perfectly.