'Add Terms of Use to the registeration form.', 'title' => 'Terms of Use', 'page callback' => 'drupal_get_form', 'page arguments' => array('terms_of_use_admin_settings'), 'access arguments' => array('administer site configuration'), ); return $items; } function terms_of_use_admin_settings() { $form['terms_of_use_node'] = array( '#type' => 'textfield', '#title' => t('Node id where Terms of Use are published'), '#default_value' => variable_get('terms_of_use_node', ''), '#description' => t('Node id of the page or story where Terms of Use are published. Do not promote this node.'), ); $form['terms_of_use_title'] = array( '#type' => 'textfield', '#title' => t('Title of the Terms of Use fieldset.'), '#default_value' => variable_get('terms_of_use_title', t('Terms of Use')), '#description' => t('The Terms of Use and the checkbox appear in a fieldset. Type here a title for that fieldset.'), ); $form['terms_of_use_text_next_to_the_checkbox'] = array( '#type' => 'textfield', '#title' => t('Text that will appear next to the checkbox.'), '#default_value' => variable_get('terms_of_use_text_next_to_the_checkbox', t('I agree with these terms.')), '#description' => t('Type here something like "I agree with these terms." or "I CERTIFY THAT I AM OVER THE AGE OF 18 YEARS OLD." Without quotes.'), ); return system_settings_form($form); } /* * Implementation of hook_form_alter */ function terms_of_use_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'user_register') { // Adding the fieldset $form['terms_of_use'] = array( '#type' => 'fieldset', '#title' => variable_get('terms_of_use_title', t('Terms of Use')), '#weight' => 10, ); // Getting the node that contains the Terms of Use $node = node_load(variable_get('terms_of_use_node', '')); if (isset($node)) { $terms_of_use = node_prepare($node)->body; } else { $terms_of_use = ''; } // Adding the Terms of Use to the fieldset $form['terms_of_use']['terms_of_use_text'] = array( '#prefix' => '
' . print_r($form_state['values'], TRUE) . ''); if ($value == 0) { form_set_error('I_agree', t('You must agree with the Terms of Use to get an account.')); } }