ID : $pid = NULL; // See if the checkbox #login_accept was checked if ( isset( $_REQUEST['login_accept'] ) && $_REQUEST['login_accept'] == 'on' ) { // Checkbox on, allow login return $user; } else { // Did NOT check the box, do not allow login $error = new WP_Error(); $error->add('did_not_accept', $dbfail); if(isset($bp->signup)) { $bp->signup->errors['login_accept'] = '
'.$dbfail.'
'; } return $error; } } // Add it to the appropriate hooks add_filter('wp_authenticate_user', 'wp_authenticate_user_acc', 99999, 2); add_filter('registration_errors', 'wp_authenticate_user_acc', 99999, 2); add_filter('bp_signup_validate', 'wp_authenticate_user_acc', 99999, 2); function display_terms_form() { $dbtermm = get_option('ag_termm'); $dburl = get_option('ag_url'); global $post; isset($post) ? $pid = $post->ID : $pid = NULL; $body_class = get_body_class(); global $bp; if(isset($dburl)) {$terms = get_post($dburl); $terms = apply_filters('the_content', $terms->post_content);} // Add an element to the login form, which must be checked agreeable_thickbox(); echo ''; echo '
'; if(isset($bp)){do_action( 'bp_login_accept_errors' );} echo '
'; echo '
'.$terms.'
'; } function login_terms_accept(){ $dblogin = get_option('ag_login'); if($dblogin == 1) { display_terms_form(); } } function register_terms_accept() { $dbregister = get_option('ag_register'); if($dbregister == 1) { display_terms_form(); } } // As part of WP login form construction, call our function add_filter ( 'login_form', 'login_terms_accept' ); add_filter ( 'register_form', 'register_terms_accept' ); add_action('bp_before_registration_submit_buttons', 'register_terms_accept'); function ag_widget_terms_accept() { $dblogin = get_option('ag_login'); if($dblogin == 1) { display_terms_form(); } echo ''; } add_action('bp_after_login_widget_loggedout', 'ag_widget_terms_accept'); function agreeable_thickbox() { if (! is_admin()) { wp_enqueue_script('thickbox', null, array('jquery')); wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0'); } } function agreeable_options() { add_options_page('agreeable', 'Agreeable', 'manage_options', 'terms-options', 'agoptions'); } function agoptions() { include('agreeable-options.php'); } // Add to the admin menu add_action('admin_menu', 'agreeable_options'); /* Plugin feedback form */ function feedback_form() { if(!isset($_POST['feedback_email']) && !isset($_POST['feedback_content'])) { $output = '

We want your feedback.

Have a feature idea, feedback, or question about the plugin?
We want to know- send it on over!



'; $output .= '

Buy me a cup of joe?

Feeling generous? Because I sure wouldn\'t turn down a hot cup of coffee...

'; } else { $output = '

Thank you for your feedback!

'; } echo $output; } function send_feedback() { if(isset($_POST['feedback_email']) && isset($_POST['feedback_content'])) { $to = 'ian@buildcreate.com'; $subject = 'New plugin feedback'; $message = $_POST['feedback_content']; $headers = 'From: <'.$_POST['feedback_email'].'>' . "\r\n"; wp_mail( $to, $subject, $message, $headers, '' ); } } add_action( 'plugins_loaded', 'send_feedback');