archersoftech (May 21st, 2013), hopfoto (April 22nd, 2013), manilaboy (May 6th, 2013), romainvincent (May 15th, 2013), serno (August 11th, 2013), gonesmith (April 22nd, 2013), troywhite (July 30th, 2013)
/* Create Terms of Use Link on Registration Page */
add_action('register_form','show_terms_of_use');
add_action('register_post','check_fields',10,3);
add_action('user_register', 'register_agreement');
/* Show the Terms of Use on the Registration page */
function show_terms_of_use() {
$wpsp_tou = get_option('wpsp_tou');
if(!empty($wpsp_tou)) {
$permalink = get_permalink( $wpsp_tou );
echo '<div class="registration-check"><input type="checkbox" name="agree" value="1"> Agree to Our <a href="PLACELINKHERE" target="_blank" title="Click to view our Terms and Conditions">Terms and Conditions</a>.</div>';
}
}
/* Check to see if the User data has been submitted */
function check_fields($login, $email, $errors) {
if($_POST['agree'] == '') {
global $agree;
$errors->add('empty_agree', "<strong>ERROR</strong>: You must Agree to our Terms and Conditions to Continue.");
} else {
$agree = $_POST['agree'];
}
}
/* If everything goes well add to the users meta data */
function register_agreement($user_id, $password="", $meta=array()) {
$userdata = array();
$userdata['ID'] = $user_id;
wp_update_user($userdata);
update_usermeta($user_id, 'agree','1');
}
.registration-check { margin-bottom: 20px;}
archersoftech (May 21st, 2013), hopfoto (April 22nd, 2013), manilaboy (May 6th, 2013), romainvincent (May 15th, 2013), serno (August 11th, 2013), gonesmith (April 22nd, 2013), troywhite (July 30th, 2013)
There are currently 1 users browsing this thread. (0 members and 1 guests)