Plugin Directory

Changeset 857357


Ignore:
Timestamp:
02/13/2014 05:29:34 PM (12 years ago)
Author:
buildcreate
Message:

Lots of updates, see change log.

Location:
agreeable
Files:
1 added
3 edited
3 copied

Legend:

Unmodified
Added
Removed
  • agreeable/tags/0.2/agreeable-options.php

    r856577 r857357  
    11<?php
    2         if($_POST['ag_hidden'] == 'Y') {
     2        if(isset($_POST['ag_hidden']) && $_POST['ag_hidden'] == 'Y') {
    33            //Form data sent
    44             
    5             $dbfail = $_POST['ag_fail'];
     5          $dbfail = $_POST['ag_fail'];
     6         
    67          $dbfail = stripslashes($dbfail);
    78            update_option('ag_fail', $dbfail);
    89         
    910          $dbtermm = $_POST['ag_termm'];
    10          $dbtermm = stripslashes($dbtermm);
    11             update_option('ag_termm', $dbtermm);
     11         
     12          $dbtermm = stripslashes($dbtermm);
     13          update_option('ag_termm', $dbtermm);
    1214           
    1315          $dburl = $_POST['ag_url'];
     
    1921          $dbregister = $_POST['ag_register'];
    2022          update_option('ag_register', $dbregister);
    21    
    2223             ?>
    2324       
     
    5859#feedback-form input[type="email"], #feedback-form textarea {width: 100%; display: block;}
    5960#feedback-form textarea {min-height: 100px;}
     61.checkboxes {padding-bottom: 1em;}
    6062</style>
     63
     64<?php $pages = get_pages('status=publish&numberposts=-1&posts_per_page=-1'); ?>
     65
    6166<div class="wrap">
    6267           
     
    7479                <p><label for="ag_fail"><?php _e("Failed to agree error message: " ); ?></label><input type="text" name="ag_fail" value="<?php echo $dbfail; ?>" size="20"></br><?php _e("<span class='mes'>This is what shows up if they don't check the box</span>" ); ?></p>
    7580               
    76                 <p><label for="ag_url"><?php _e("URL for Terms: " ); ?></label><input type="text" name="ag_url" value="<?php echo $dburl; ?>" size="20"></br><?php _e("<span class='mes'>This is the URL where the user can read your terms</span>" ); ?></p>
     81                <p>
     82                    <?php _e("<span class='mes'>This is the URL where the user can read your terms</span>" ); ?>
     83                    <label for="ag_url">Select your terms page</label>
     84                    <select name="ag_url">
     85                        <?php foreach ($pages as $p) { ?>
     86                            <option value="<?php echo $p->ID; ?>" <?php echo $dburl == $p->ID ? 'selected="selected"' : ''; ?>><?php echo $p->post_title; ?></option>
     87                        <?php } ?>
     88                    </select>
     89                </p>
    7790               
    7891                <p><label for="ag_termm"><?php _e("Message: " ); ?></label><input type="text"  name="ag_termm" size="40" value="<?php echo $dbtermm; ?>"><br><?php _e("<span class='mes'>This is the text that goes right after the checkbox</span>" ); ?></p>
     
    8295                                <p>
    8396                <h3><?php _e("Where should it be displayed? " ); ?></h3>
    84                     <input type="checkbox" id="ag_login" name="ag_login" value="1" <?php if($dblogin == 1) {echo 'checked';} ?> /> <label for="ag_login">Login form</label><br>
     97                    <input type="checkbox" id="ag_login" name="ag_login" value="1" <?php if($dblogin == 1) {echo 'checked';} ?> /> <label for="ag_login"> Login form</label><br>
    8598                    <input type="checkbox" id="ag_register" name="ag_register" value="1" <?php if($dbregister == 1) {echo 'checked';} ?> /> <label for="ag_register">Registration form</label>
    8699                    </p>
    87                 </div>
     100                </div>             
    88101           
    89102                <p class="submit">
  • agreeable/tags/0.2/agreeable.php

    r856577 r857357  
    44Plugin URI: http://wordpress.org/extend/plugins/agreeable
    55Description: Add a required "Agree to terms" checkbox to login and/or register forms.  Based on the I-Agree plugin by Michael Stursberg.
    6 Version: 0.1.2.1
    7 Author: buildcreate, thesturs
     6Version: 0.2
     7Author: buildcreate
    88Author URI: http://buildcreate.com
    99*/
    1010
    11 function wp_authenticate_user_acc($user, $password) {
     11function wp_authenticate_user_acc($user) {
    1212   
    1313    $dblogin = get_option('ag_login');
    1414    $dbregister = get_option('ag_register');
     15    $dbfail = get_option('ag_fail');
     16    $body_class = get_body_class();
     17    $login_page = get_option('ag_login_page');
     18    $register_page = get_option('ag_register_page');
    1519   
    16     if($GLOBALS['pagenow'] == 'wp-login.php' && $dblogin == 1 || in_array('login', $body_class) && $dblogin == 1 || $GLOBALS['pagenow'] == 'wp-register.php' && $dbregister == 1 || in_array('register', $body_class) && $dbregister == 1 ) {
    17    
    18          $dbfail = get_option('ag_fail');
     20    global $bp, $post;
     21    isset($post) ? $pid = $post->ID : $pid = NULL;
    1922         
    2023          // See if the checkbox #login_accept was checked
     
    2427        } else {
    2528            // Did NOT check the box, do not allow login
     29           
    2630            $error = new WP_Error();
    2731            $error->add('did_not_accept', $dbfail);
     32             
     33              if(isset($bp->signup)) {
     34                    $bp->signup->errors['login_accept'] = '<div class="error">'.$dbfail.'</div>';
     35            }
     36           
    2837            return $error;
    2938        }
    30     } else {
    31         return $user;
    32     }
     39
     40}
     41
     42// Add it to the appropriate hooks
     43add_filter('wp_authenticate_user', 'wp_authenticate_user_acc', 99999, 2);
     44add_filter('registration_errors', 'wp_authenticate_user_acc', 99999, 2);
     45add_filter('bp_signup_validate', 'wp_authenticate_user_acc', 99999, 2);
     46
     47function display_terms_form() {
     48    $dbtermm = get_option('ag_termm');
     49    $dburl = get_option('ag_url');
     50   
     51    global $post;
     52    isset($post) ? $pid = $post->ID : $pid = NULL;
     53    $body_class = get_body_class();
     54   
     55    global $bp;
     56 
     57   if(isset($dburl)) {$terms = get_post($dburl); $terms = apply_filters('the_content', $terms->post_content);}   
     58 
     59    // Add an element to the login form, which must be checked
     60   
     61    agreeable_thickbox();
     62   
     63    echo '<style>#terms{display: none} #TB_ajaxContent p {font-weight: 200; line-height: 1.5em;}</style>';
     64    echo '<div style="clear: both; padding: .25em 0;" id="terms-accept" class="terms-form">';
     65        if(isset($bp)){do_action( 'bp_login_accept_errors' );}
     66    echo '<label style="text-align: left;"><input type="checkbox" name="login_accept" id="login_accept" />&nbsp;<a title="'.get_post($dburl)->post_title.'" class="thickbox" target="_BLANK" href="#TB_inline?width=600&height=550&inlineId=terms">'.$dbtermm.'</a></label></div>';
     67   
     68    echo '<div id="terms"><div>'.$terms.'</div></div>';
     69}
     70
     71function login_terms_accept(){
     72    $dblogin = get_option('ag_login');
     73   
     74    if($dblogin == 1) {
     75        display_terms_form();
     76    }
     77}
     78
     79function register_terms_accept() {
     80   
     81    $dbregister = get_option('ag_register');
     82   
     83    if($dbregister == 1) {
     84        display_terms_form();
     85    }
    3386}
    3487
    3588// As part of WP login form construction, call our function
    36 add_filter ( 'login_form', 'terms_accept' );
    37 add_filter ( 'register_form', 'terms_accept' );
    38 add_action('bp_before_registration_submit_buttons', 'terms_accept');
     89add_filter ( 'login_form', 'login_terms_accept' );
     90add_filter ( 'register_form', 'register_terms_accept' );
     91add_action('bp_before_registration_submit_buttons', 'register_terms_accept');
    3992
    40 function terms_accept(){
    41     $dbtermm = get_option('ag_termm');
    42     $dburl = get_option('ag_url');
     93
     94function ag_widget_terms_accept() {
     95
    4396    $dblogin = get_option('ag_login');
    44     $dbregister = get_option('ag_register');
    45     global $post;
    46     $body_class = get_body_class();
    4797   
    48 if($GLOBALS['pagenow'] == 'wp-login.php' && $dblogin == 1 || in_array('login', $body_class) && $dblogin == 1 || $GLOBALS['pagenow'] == 'wp-register.php' && $dbregister == 1 || in_array('register', $body_class) && $dbregister == 1 ) {
     98    if($dblogin == 1) {
     99        display_terms_form();
     100    }
     101   
     102    echo '<script>';
     103        echo '
     104            jQuery(document).ready(function($){
     105                $("#terms-accept").insertBefore("#bp-login-widget-rememberme");
     106                $("#bp-login-widget-form").nextAll(".terms-form").hide();
     107            });
     108        ';
     109    echo '</script>';
     110   
     111}
    49112
    50    
    51         // Add an element to the login form, which must be checked
    52         echo '<div id="terms-accept"><label><input type="checkbox" name="login_accept" id="login_accept" />&nbsp;<a target="_BLANK" href="'.$dburl.'">'.$dbtermm.'</a></label></div><br>';
    53     }
     113add_action('bp_after_login_widget_loggedout', 'ag_widget_terms_accept');
     114
     115function agreeable_thickbox() {
     116    if (! is_admin()) {
     117        wp_enqueue_script('thickbox', null,  array('jquery'));
     118        wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');
     119    }
    54120}
    55121
     
    65131add_action('admin_menu', 'agreeable_options');
    66132
    67 // Add it to the appropriate hooks
    68 add_filter('wp_authenticate_user', 'wp_authenticate_user_acc', 99999, 2);
    69 add_filter('registration_errors', 'wp_authenticate_user_acc', 99999, 2);
    70 add_filter('bp_signup_validate', 'wp_authenticate_user_acc', 9999, 2);
    71 
    72133
    73134/* Plugin feedback form */
     
    75136function feedback_form() {
    76137   
    77     if(!$_POST['feedback_email'] && !$_POST['feedback_content']) {
     138    if(!isset($_POST['feedback_email']) && !isset($_POST['feedback_content'])) {
    78139   
    79140    $output = '<h3>We want your feedback.</h3>
  • agreeable/tags/0.2/readme.txt

    r856579 r857357  
    11=== Agreeable ===
    2 Contributors: buildcreate 
    3 Tags: agree, terms, conditions, require, terms, login, log in, admin, login page, admin, buddy press, page, policy, privacy
     2Contributors: buildcreate, thesturs
     3Tags: agree, terms, conditions, require, terms, login, log in, admin, login page, admin, buddy press, page, policy, privacy, bbpress, theme my login, signup, register, widgets
    44Requires at least: 3.5
    55Tested up to: 3.8.1
    66Stable tag: trunk
    77License:GPLv2 or later
    8 Add an "Agree to terms" check box on login and/or registration pages.  Works with BuddyPress.
     8Add an "Agree to terms" check box on login and/or registration pages.  Works with BuddyPress and bbPress
    99
    1010== Description ==
     
    1212
    1313Use the form in the plugin settings page to contact us with feature requests, comments, or concerns.
     14
     15= New Features =
     16* Now you select your terms page from a dropdown
     17* Terms now open in a lightbox
     18* Tested with WP, BuddyPress, and bbPress login widgets
     19* Updated error display for BuddyPress
     20* Works with custom Login/Registration pages (like Theme My Login)
    1421
    1522= Rated 4 stars by the WP Plugins A to Z podcast! =
     
    2532
    2633== Changelog ==
     34
     35= 0.2 =
     36* Resolved a few warnings and notices that were cropping up
     37* Now you select your terms page from a dropdown
     38* Terms now open in a lightbox
     39* Tested with WP, BuddyPress, and bbPress login widgets
     40* Updated error display for BuddyPress
     41* Works with custom Login/Registration pages (like Theme My Login)
    2742
    2843= 0.1.2.1 =
  • agreeable/trunk/agreeable-options.php

    r856577 r857357  
    11<?php
    2         if($_POST['ag_hidden'] == 'Y') {
     2        if(isset($_POST['ag_hidden']) && $_POST['ag_hidden'] == 'Y') {
    33            //Form data sent
    44             
    5             $dbfail = $_POST['ag_fail'];
     5          $dbfail = $_POST['ag_fail'];
     6         
    67          $dbfail = stripslashes($dbfail);
    78            update_option('ag_fail', $dbfail);
    89         
    910          $dbtermm = $_POST['ag_termm'];
    10          $dbtermm = stripslashes($dbtermm);
    11             update_option('ag_termm', $dbtermm);
     11         
     12          $dbtermm = stripslashes($dbtermm);
     13          update_option('ag_termm', $dbtermm);
    1214           
    1315          $dburl = $_POST['ag_url'];
     
    1921          $dbregister = $_POST['ag_register'];
    2022          update_option('ag_register', $dbregister);
    21    
    2223             ?>
    2324       
     
    5859#feedback-form input[type="email"], #feedback-form textarea {width: 100%; display: block;}
    5960#feedback-form textarea {min-height: 100px;}
     61.checkboxes {padding-bottom: 1em;}
    6062</style>
     63
     64<?php $pages = get_pages('status=publish&numberposts=-1&posts_per_page=-1'); ?>
     65
    6166<div class="wrap">
    6267           
     
    7479                <p><label for="ag_fail"><?php _e("Failed to agree error message: " ); ?></label><input type="text" name="ag_fail" value="<?php echo $dbfail; ?>" size="20"></br><?php _e("<span class='mes'>This is what shows up if they don't check the box</span>" ); ?></p>
    7580               
    76                 <p><label for="ag_url"><?php _e("URL for Terms: " ); ?></label><input type="text" name="ag_url" value="<?php echo $dburl; ?>" size="20"></br><?php _e("<span class='mes'>This is the URL where the user can read your terms</span>" ); ?></p>
     81                <p>
     82                    <?php _e("<span class='mes'>This is the URL where the user can read your terms</span>" ); ?>
     83                    <label for="ag_url">Select your terms page</label>
     84                    <select name="ag_url">
     85                        <?php foreach ($pages as $p) { ?>
     86                            <option value="<?php echo $p->ID; ?>" <?php echo $dburl == $p->ID ? 'selected="selected"' : ''; ?>><?php echo $p->post_title; ?></option>
     87                        <?php } ?>
     88                    </select>
     89                </p>
    7790               
    7891                <p><label for="ag_termm"><?php _e("Message: " ); ?></label><input type="text"  name="ag_termm" size="40" value="<?php echo $dbtermm; ?>"><br><?php _e("<span class='mes'>This is the text that goes right after the checkbox</span>" ); ?></p>
     
    8295                                <p>
    8396                <h3><?php _e("Where should it be displayed? " ); ?></h3>
    84                     <input type="checkbox" id="ag_login" name="ag_login" value="1" <?php if($dblogin == 1) {echo 'checked';} ?> /> <label for="ag_login">Login form</label><br>
     97                    <input type="checkbox" id="ag_login" name="ag_login" value="1" <?php if($dblogin == 1) {echo 'checked';} ?> /> <label for="ag_login"> Login form</label><br>
    8598                    <input type="checkbox" id="ag_register" name="ag_register" value="1" <?php if($dbregister == 1) {echo 'checked';} ?> /> <label for="ag_register">Registration form</label>
    8699                    </p>
    87                 </div>
     100                </div>             
    88101           
    89102                <p class="submit">
  • agreeable/trunk/agreeable.php

    r856577 r857357  
    44Plugin URI: http://wordpress.org/extend/plugins/agreeable
    55Description: Add a required "Agree to terms" checkbox to login and/or register forms.  Based on the I-Agree plugin by Michael Stursberg.
    6 Version: 0.1.2.1
    7 Author: buildcreate, thesturs
     6Version: 0.2
     7Author: buildcreate
    88Author URI: http://buildcreate.com
    99*/
    1010
    11 function wp_authenticate_user_acc($user, $password) {
     11function wp_authenticate_user_acc($user) {
    1212   
    1313    $dblogin = get_option('ag_login');
    1414    $dbregister = get_option('ag_register');
     15    $dbfail = get_option('ag_fail');
     16    $body_class = get_body_class();
     17    $login_page = get_option('ag_login_page');
     18    $register_page = get_option('ag_register_page');
    1519   
    16     if($GLOBALS['pagenow'] == 'wp-login.php' && $dblogin == 1 || in_array('login', $body_class) && $dblogin == 1 || $GLOBALS['pagenow'] == 'wp-register.php' && $dbregister == 1 || in_array('register', $body_class) && $dbregister == 1 ) {
    17    
    18          $dbfail = get_option('ag_fail');
     20    global $bp, $post;
     21    isset($post) ? $pid = $post->ID : $pid = NULL;
    1922         
    2023          // See if the checkbox #login_accept was checked
     
    2427        } else {
    2528            // Did NOT check the box, do not allow login
     29           
    2630            $error = new WP_Error();
    2731            $error->add('did_not_accept', $dbfail);
     32             
     33              if(isset($bp->signup)) {
     34                    $bp->signup->errors['login_accept'] = '<div class="error">'.$dbfail.'</div>';
     35            }
     36           
    2837            return $error;
    2938        }
    30     } else {
    31         return $user;
    32     }
     39
     40}
     41
     42// Add it to the appropriate hooks
     43add_filter('wp_authenticate_user', 'wp_authenticate_user_acc', 99999, 2);
     44add_filter('registration_errors', 'wp_authenticate_user_acc', 99999, 2);
     45add_filter('bp_signup_validate', 'wp_authenticate_user_acc', 99999, 2);
     46
     47function display_terms_form() {
     48    $dbtermm = get_option('ag_termm');
     49    $dburl = get_option('ag_url');
     50   
     51    global $post;
     52    isset($post) ? $pid = $post->ID : $pid = NULL;
     53    $body_class = get_body_class();
     54   
     55    global $bp;
     56 
     57   if(isset($dburl)) {$terms = get_post($dburl); $terms = apply_filters('the_content', $terms->post_content);}   
     58 
     59    // Add an element to the login form, which must be checked
     60   
     61    agreeable_thickbox();
     62   
     63    echo '<style>#terms{display: none} #TB_ajaxContent p {font-weight: 200; line-height: 1.5em;}</style>';
     64    echo '<div style="clear: both; padding: .25em 0;" id="terms-accept" class="terms-form">';
     65        if(isset($bp)){do_action( 'bp_login_accept_errors' );}
     66    echo '<label style="text-align: left;"><input type="checkbox" name="login_accept" id="login_accept" />&nbsp;<a title="'.get_post($dburl)->post_title.'" class="thickbox" target="_BLANK" href="#TB_inline?width=600&height=550&inlineId=terms">'.$dbtermm.'</a></label></div>';
     67   
     68    echo '<div id="terms"><div>'.$terms.'</div></div>';
     69}
     70
     71function login_terms_accept(){
     72    $dblogin = get_option('ag_login');
     73   
     74    if($dblogin == 1) {
     75        display_terms_form();
     76    }
     77}
     78
     79function register_terms_accept() {
     80   
     81    $dbregister = get_option('ag_register');
     82   
     83    if($dbregister == 1) {
     84        display_terms_form();
     85    }
    3386}
    3487
    3588// As part of WP login form construction, call our function
    36 add_filter ( 'login_form', 'terms_accept' );
    37 add_filter ( 'register_form', 'terms_accept' );
    38 add_action('bp_before_registration_submit_buttons', 'terms_accept');
     89add_filter ( 'login_form', 'login_terms_accept' );
     90add_filter ( 'register_form', 'register_terms_accept' );
     91add_action('bp_before_registration_submit_buttons', 'register_terms_accept');
    3992
    40 function terms_accept(){
    41     $dbtermm = get_option('ag_termm');
    42     $dburl = get_option('ag_url');
     93
     94function ag_widget_terms_accept() {
     95
    4396    $dblogin = get_option('ag_login');
    44     $dbregister = get_option('ag_register');
    45     global $post;
    46     $body_class = get_body_class();
    4797   
    48 if($GLOBALS['pagenow'] == 'wp-login.php' && $dblogin == 1 || in_array('login', $body_class) && $dblogin == 1 || $GLOBALS['pagenow'] == 'wp-register.php' && $dbregister == 1 || in_array('register', $body_class) && $dbregister == 1 ) {
     98    if($dblogin == 1) {
     99        display_terms_form();
     100    }
     101   
     102    echo '<script>';
     103        echo '
     104            jQuery(document).ready(function($){
     105                $("#terms-accept").insertBefore("#bp-login-widget-rememberme");
     106                $("#bp-login-widget-form").nextAll(".terms-form").hide();
     107            });
     108        ';
     109    echo '</script>';
     110   
     111}
    49112
    50    
    51         // Add an element to the login form, which must be checked
    52         echo '<div id="terms-accept"><label><input type="checkbox" name="login_accept" id="login_accept" />&nbsp;<a target="_BLANK" href="'.$dburl.'">'.$dbtermm.'</a></label></div><br>';
    53     }
     113add_action('bp_after_login_widget_loggedout', 'ag_widget_terms_accept');
     114
     115function agreeable_thickbox() {
     116    if (! is_admin()) {
     117        wp_enqueue_script('thickbox', null,  array('jquery'));
     118        wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');
     119    }
    54120}
    55121
     
    65131add_action('admin_menu', 'agreeable_options');
    66132
    67 // Add it to the appropriate hooks
    68 add_filter('wp_authenticate_user', 'wp_authenticate_user_acc', 99999, 2);
    69 add_filter('registration_errors', 'wp_authenticate_user_acc', 99999, 2);
    70 add_filter('bp_signup_validate', 'wp_authenticate_user_acc', 9999, 2);
    71 
    72133
    73134/* Plugin feedback form */
     
    75136function feedback_form() {
    76137   
    77     if(!$_POST['feedback_email'] && !$_POST['feedback_content']) {
     138    if(!isset($_POST['feedback_email']) && !isset($_POST['feedback_content'])) {
    78139   
    79140    $output = '<h3>We want your feedback.</h3>
  • agreeable/trunk/readme.txt

    r856579 r857357  
    11=== Agreeable ===
    2 Contributors: buildcreate 
    3 Tags: agree, terms, conditions, require, terms, login, log in, admin, login page, admin, buddy press, page, policy, privacy
     2Contributors: buildcreate, thesturs
     3Tags: agree, terms, conditions, require, terms, login, log in, admin, login page, admin, buddy press, page, policy, privacy, bbpress, theme my login, signup, register, widgets
    44Requires at least: 3.5
    55Tested up to: 3.8.1
    66Stable tag: trunk
    77License:GPLv2 or later
    8 Add an "Agree to terms" check box on login and/or registration pages.  Works with BuddyPress.
     8Add an "Agree to terms" check box on login and/or registration pages.  Works with BuddyPress and bbPress
    99
    1010== Description ==
     
    1212
    1313Use the form in the plugin settings page to contact us with feature requests, comments, or concerns.
     14
     15= New Features =
     16* Now you select your terms page from a dropdown
     17* Terms now open in a lightbox
     18* Tested with WP, BuddyPress, and bbPress login widgets
     19* Updated error display for BuddyPress
     20* Works with custom Login/Registration pages (like Theme My Login)
    1421
    1522= Rated 4 stars by the WP Plugins A to Z podcast! =
     
    2532
    2633== Changelog ==
     34
     35= 0.2 =
     36* Resolved a few warnings and notices that were cropping up
     37* Now you select your terms page from a dropdown
     38* Terms now open in a lightbox
     39* Tested with WP, BuddyPress, and bbPress login widgets
     40* Updated error display for BuddyPress
     41* Works with custom Login/Registration pages (like Theme My Login)
    2742
    2843= 0.1.2.1 =
Note: See TracChangeset for help on using the changeset viewer.