Plugin Directory

Changeset 706791


Ignore:
Timestamp:
05/02/2013 05:52:47 AM (13 years ago)
Author:
radiok
Message:

Add new additional field type, "Terms", in preparation to phase-out Disclaimer, License Agreement, and Privacy Policy

Location:
register-plus-redux/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • register-plus-redux/trunk/register-plus-redux.php

    r706291 r706791  
    233233           
    234234            $valid_value = TRUE;
     235            if ( 'text' === $meta_field['display'] ) $valid_value = FALSE;
    235236            // poor man's way to ensure required fields aren't blanked out, really should have a separate config per field
    236237            if ( '1' === $meta_field['require_on_registration'] && empty( $meta_value ) ) $valid_value = FALSE;
     
    240241            if ( 'textarea' === $meta_field['display'] ) $meta_value = wp_filter_kses( $meta_value );
    241242           
    242             if ( $valid_value ) update_user_meta( $user_id, $meta_field['meta_key'], $meta_value );
     243            if ( $valid_value ) {
     244                update_user_meta( $user_id, $meta_field['meta_key'], $meta_value );
     245                if ( 'terms' === $meta_field['display'] ) update_user_meta( $user_id, $meta_field['meta_key'] . '_date', time() );
     246            }
    243247        }
    244248
     
    277281        // $profileuser is a WP_User object
    278282        public /*.void.*/ function rpr_show_custom_fields( $profileuser ) {
     283            $additional_fields_exist = FALSE;
     284            $terms_exist = FALSE;
     285
    279286            /*.array[]mixed.*/ $redux_usermeta = get_option( 'register_plus_redux_usermeta-rv2' );
    280287            if ( '1' === $this->rpr_get_option( 'enable_invitation_code' ) || is_array( $redux_usermeta ) ) {
    281                 echo '<h3>', __( 'Additional Information', 'register-plus-redux' ), '</h3>';
    282                 echo '<table class="form-table">';
    283                 if ( '1' === $this->rpr_get_option( 'enable_invitation_code' ) ) {
    284                     echo "\n", '<tr>';
    285                     echo "\n", '<th><label for="invitation_code">', __( 'Invitation Code', 'register-plus-redux' ), '</label></th>';
    286                     echo "\n", '<td><input type="text" name="invitation_code" id="invitation_code" value="', esc_attr( $profileuser->invitation_code ), '" class="regular-text" ';
    287                     if ( !current_user_can( 'edit_users' ) ) echo 'readonly="readonly" ';
    288                     echo '/></td>';
    289                     echo "\n", '</tr>';
    290                 }
    291288                if ( is_array( $redux_usermeta ) ) {
    292289                    foreach ( $redux_usermeta as $meta_field ) {
    293                         if ( current_user_can( 'edit_users' ) || '1' === $meta_field['show_on_profile'] ) {
     290                        if ( 'terms' !== $meta_field['display'] ) {
     291                            $additional_fields_exist = TRUE;
     292                            break;
     293                        }
     294                        else if ( 'terms' === $meta_field['display'] ) { $term_exist = TRUE; }
     295                    }
     296                }
     297                if ( '1' === $this->rpr_get_option( 'enable_invitation_code' ) || $additional_fields_exist ) {
     298                    echo '<h3>', __( 'Additional Information', 'register-plus-redux' ), '</h3>';
     299                    echo '<table class="form-table">';
     300                    if ( '1' === $this->rpr_get_option( 'enable_invitation_code' ) ) {
     301                        echo "\n", '<tr>';
     302                        echo "\n", '<th><label for="invitation_code">', __( 'Invitation Code', 'register-plus-redux' ), '</label></th>';
     303                        echo "\n", '<td><input type="text" name="invitation_code" id="invitation_code" value="', esc_attr( $profileuser->invitation_code ), '" class="regular-text" ';
     304                        if ( !current_user_can( 'edit_users' ) ) echo 'readonly="readonly" ';
     305                        echo '/></td>';
     306                        echo "\n", '</tr>';
     307                    }
     308                    if ( $additional_fields_exist ) {
     309                        foreach ( $redux_usermeta as $meta_field ) {
     310                            if ( current_user_can( 'edit_users' ) || '1' === $meta_field['show_on_profile'] ) {
     311                                if ( 'terms' === $meta_field['display'] ) continue;
     312                                $meta_key = (string) esc_attr( $meta_field['meta_key'] );
     313                                $meta_value = get_user_meta( $profileuser->ID, $meta_key, TRUE );
     314                                if ( 'checkbox' === $meta_field['display'] ) {
     315                                    $meta_value = (array) get_user_meta( $profileuser->ID, $meta_key, TRUE );
     316                                }
     317                                else {
     318                                    $meta_value = (string) get_user_meta( $profileuser->ID, $meta_key, TRUE );
     319                                }
     320                                echo "\n", '<tr>';
     321                                echo "\n", '<th><label for="', $meta_key, '">', esc_html( $meta_field['label'] );
     322                                if ( '1' !== $meta_field['show_on_profile'] ) echo ' <span class="description">(hidden)</span>';
     323                                if ( '1' ===  $meta_field['require_on_registration'] ) echo ' <span class="description">(required)</span>';
     324                                echo '</label></th>';
     325                                switch ( (string) $meta_field['display'] ) {
     326                                    case 'textbox':
     327                                        echo "\n", '<td><input type="text" name="', $meta_key, '" id="', $meta_key, '" ';
     328                                        if ( '1' === $meta_field['show_datepicker'] ) echo 'class="datepicker" ';
     329                                        echo 'value="', esc_attr( $meta_value ), '" class="regular-text" /></td>';
     330                                        break;
     331                                    case 'select':
     332                                        echo "\n", '<td>';
     333                                        echo "\n", '<select name="', $meta_key, '" id="', $meta_key, '" style="width: 15em;">';
     334                                        /*.array[]string.*/ $field_options = explode( ',', (string) $meta_field['options'] );
     335                                        foreach ( $field_options as $field_option ) {
     336                                            echo "\n", '<option value="', esc_attr( $field_option ), '"';
     337                                            if ( $meta_value === esc_attr( $field_option ) ) echo ' selected="selected"';
     338                                            echo '>', esc_html( $field_option ), '</option>';
     339                                        }
     340                                        echo "\n", '</select>';
     341                                        echo "\n", '</td>';
     342                                        break;
     343                                    case 'checkbox':
     344                                        echo "\n", '<td>';
     345                                        /*.array[]string.*/ $field_options = explode( ',', (string) $meta_field['options'] );
     346                                        /*.array[]string.*/ $meta_values = explode( ',', (string) $meta_value );
     347                                        foreach ( $field_options as $field_option ) {
     348                                            echo "\n", '<label><input type="checkbox" name="', $meta_key, '[]" value="', esc_attr( $field_option ), '" ';
     349                                            if ( in_array( esc_attr( $field_option ), $meta_values ) ) echo 'checked="checked" ';
     350                                            echo '/>&nbsp;', esc_html( $field_option ), '</label><br />';
     351                                        }
     352                                        echo "\n", '</td>';
     353                                        break;
     354                                    case 'radio':
     355                                        echo "\n", '<td>';
     356                                        /*.array[]string.*/ $field_options = explode( ',', (string) $meta_field['options'] );
     357                                        foreach ( $field_options as $field_option ) {
     358                                            echo "\n", '<label><input type="radio" name="', $meta_key, '" value="', esc_attr( $field_option ), '" ';
     359                                            if ( $meta_value === esc_attr( $field_option ) ) echo 'checked="checked" ';
     360                                            echo 'class="tog">&nbsp;', esc_html( $field_option ), '</label><br />';
     361                                        }
     362                                        echo "\n", '</td>';
     363                                        break;
     364                                    case 'textarea':
     365                                        echo "\n", '<td><textarea name="', $meta_key, '" id="', $meta_key, '" cols="25" rows="5">', esc_textarea( $meta_value ), '</textarea></td>';
     366                                        break;
     367                                    case 'hidden':
     368                                        echo "\n", '<td><input type="text" disabled="disabled" name="', $meta_key, '" id="', $meta_key, '" value="', esc_attr( $meta_value ), '" /></td>';
     369                                        break;
     370                                    case 'text':
     371                                        echo "\n", '<td><span class="description">', esc_html( $meta_field['label'] ), '</span></td>';
     372                                        break;
     373                                    default:
     374                                }
     375                                echo "\n", '</tr>';
     376                            }
     377                        }
     378                    }
     379                    echo '</table>';
     380                }
     381            }
     382            if ( is_array( $redux_usermeta ) ) {
     383                if ( !$terms_exist ) {
     384                    foreach ( $redux_usermeta as $meta_field ) {
     385                        if ( 'terms' === $meta_field['display'] ) {
     386                            $terms_exist = TRUE;
     387                            break;
     388                        }
     389                    }
     390                }
     391                if ( $terms_exist ) {
     392                    echo '<h3>', __( 'Terms', 'register-plus-redux' ), '</h3>';
     393                    echo '<table class="form-table">';
     394                    foreach ( $redux_usermeta as $meta_field ) {
     395                        if ( 'terms' === $meta_field['display'] ) {
    294396                            $meta_key = (string) esc_attr( $meta_field['meta_key'] );
    295                             $meta_value = get_user_meta( $profileuser->ID, $meta_key, TRUE );
     397                            $meta_value = (string) get_user_meta( $profileuser->ID, $meta_key, TRUE );
     398                            $meta_value = !empty( $meta_value ) ? $meta_value : 'N';
     399                            $meta_value_date = (int) get_user_meta( $profileuser->ID, $meta_key . '_date', TRUE );
    296400                            echo "\n", '<tr>';
    297                             echo "\n", '<th><label for="', $meta_key, '">', esc_html( $meta_field['label'] );
    298                             if ( '1' !== $meta_field['show_on_profile'] ) echo ' <span class="description">(hidden)</span>';
     401                            echo "\n", '<th>', esc_html( $meta_field['label'] );
    299402                            if ( '1' ===  $meta_field['require_on_registration'] ) echo ' <span class="description">(required)</span>';
    300403                            echo '</label></th>';
    301                             switch ( (string) $meta_field['display'] ) {
    302                                 case 'textbox':
    303                                     echo "\n", '<td><input type="text" name="', $meta_key, '" id="', $meta_key, '" ';
    304                                     if ( '1' === $meta_field['show_datepicker'] ) echo 'class="datepicker" ';
    305                                     echo 'value="', esc_attr( $meta_value ), '" class="regular-text" /></td>';
    306                                     break;
    307                                 case 'select':
    308                                     echo "\n", '<td>';
    309                                     echo "\n", '<select name="', $meta_key, '" id="', $meta_key, '" style="width: 15em;">';
    310                                     /*.array[]string.*/ $field_options = explode( ',', (string) $meta_field['options'] );
    311                                     foreach ( $field_options as $field_option ) {
    312                                         echo "\n", '<option value="', esc_attr( $field_option ), '"';
    313                                         if ( $meta_value === esc_attr( $field_option ) ) echo ' selected="selected"';
    314                                         echo '>', esc_html( $field_option ), '</option>';
    315                                     }
    316                                     echo "\n", '</select>';
    317                                     echo "\n", '</td>';
    318                                     break;
    319                                 case 'checkbox':
    320                                     echo "\n", '<td>';
    321                                     /*.array[]string.*/ $field_options = explode( ',', (string) $meta_field['options'] );
    322                                     /*.array[]string.*/ $meta_values = explode( ',', (string) $meta_value );
    323                                     foreach ( $field_options as $field_option ) {
    324                                         echo "\n", '<label><input type="checkbox" name="', $meta_key, '[]" value="', esc_attr( $field_option ), '" ';
    325                                         if ( in_array( esc_attr( $field_option ), $meta_values ) ) echo 'checked="checked" ';
    326                                         echo '/>&nbsp;', esc_html( $field_option ), '</label><br />';
    327                                     }
    328                                     echo "\n", '</td>';
    329                                     break;
    330                                 case 'radio':
    331                                     echo "\n", '<td>';
    332                                     /*.array[]string.*/ $field_options = explode( ',', (string) $meta_field['options'] );
    333                                     foreach ( $field_options as $field_option ) {
    334                                         echo "\n", '<label><input type="radio" name="', $meta_key, '" value="', esc_attr( $field_option ), '" ';
    335                                         if ( $meta_value === esc_attr( $field_option ) ) echo 'checked="checked" ';
    336                                         echo 'class="tog">&nbsp;', esc_html( $field_option ), '</label><br />';
    337                                     }
    338                                     echo "\n", '</td>';
    339                                     break;
    340                                 case 'textarea':
    341                                     echo "\n", '<td><textarea name="', $meta_key, '" id="', $meta_key, '" cols="25" rows="5">', esc_textarea( $meta_value ), '</textarea></td>';
    342                                     break;
    343                                 case 'hidden':
    344                                     echo "\n", '<td><input type="text" disabled="disabled" name="', $meta_key, '" id="', $meta_key, '" value="', esc_attr( $meta_value ), '" /></td>';
    345                                     break;
    346                                 case 'text':
    347                                     echo "\n", '<td><span class="description">', esc_html( $meta_field['label'] ), '</span></td>';
    348                                     break;
    349                                 default:
    350                             }
     404                            echo "\n", '<td>';
     405                            echo "\n", nl2br( $meta_field['terms_content'] ), '<br />';
     406                            echo "\n", '<span class="description">', __( 'Last Revised:', 'register-plus-redux' ), ' ', date( "m/d/Y", $meta_field['date_revised'] ), '</span><br />';
     407                            echo "\n", '<span class="description">', __( 'Accepted:', 'register-plus-redux' ), ' ', esc_html( $meta_value );
     408                            if ( 'Y' === $meta_value ) echo ' on ', date( "m/d/Y", $meta_value_date );
     409                            echo '</span>';
     410                            echo "\n", '</td>';
    351411                            echo "\n", '</tr>';
    352412                        }
    353413                    }
    354                 }
    355                 echo '</table>';
     414                    echo '</table>';
     415                }
    356416            }
    357417        }
     
    366426            if ( is_array( $redux_usermeta ) ) {
    367427                foreach ( $redux_usermeta as $meta_field ) {
    368                     if ( 'text' !== $meta_field['display'] ) {
     428                    if ( 'text' !== $meta_field['display'] && 'terms' !== $meta_field['display'] ) {
    369429                        if ( current_user_can( 'edit_users' ) || '1' === $meta_field['show_on_profile'] ) {
    370430                            if ( 'checkbox' === $meta_field['display'] ) {
  • register-plus-redux/trunk/rpr-activate.php

    r675419 r706791  
    7575                foreach ( $redux_usermeta as $meta_field ) {
    7676                    if ( '1' === $meta_field['show_on_registration'] ) {
    77                         if ( !empty( $meta[$meta_field['meta_key']] ) ) $register_plus_redux->rpr_update_user_meta( $user_id, $meta_field, $meta[ (string) $meta_field['meta_key']] );
     77                        if ( 'checkbox' === $meta_field['display'] ) {
     78                            $meta_value = isset( $meta[ (string) $meta_field['meta_key']] ) ? (array) $meta[ (string) $meta_field['meta_key']] : '';
     79                        }
     80                        else if ( 'terms' === $meta_field['display'] ) {
     81                            $meta_value = isset( $meta[ (string) $meta_field['meta_key']] ) ? (string) $meta[ (string) $meta_field['meta_key']] : 'N';
     82                        }
     83                        else {
     84                            $meta_value = isset( $meta[ (string) $meta_field['meta_key']] ) ? (string) $meta[ (string) $meta_field['meta_key']] : '';
     85                        }
     86                        $register_plus_redux->rpr_update_user_meta( $user_id, $meta_field, $meta_value );
    7887                    }
    7988                }
  • register-plus-redux/trunk/rpr-admin-menu.php

    r706675 r706791  
    5050            }
    5151            // NOTE: $hookname = settings_page_register-plus-redux
    52             add_action( 'admin_print_scripts-' . $hookname, array( $this, 'rpr_options_submenu_scripts' ), 10, 1 );
    53             add_action( 'admin_print_styles-' . $hookname, array( $this, 'rpr_options_submenu_styles' ), 10, 1 );
     52            add_action( 'load-' . $hookname, array( $this, 'rpr_options_submenu_load' ), 10, 1 );
     53            //add_action( 'admin_print_scripts-' . $hookname, array( $this, 'rpr_options_submenu_scripts' ), 10, 1 );
     54            //add_action( 'admin_print_styles-' . $hookname, array( $this, 'rpr_options_submenu_styles' ), 10, 1 );
    5455            add_action( 'admin_footer-' . $hookname, array( $this, 'rpr_options_submenu_footer' ), 10, 1 );
    5556            if ( !is_multisite() ) {
     
    7374            }
    7475            return $actions;
     76        }
     77
     78        public /*.void.*/ function rpr_options_submenu_load() {
     79            add_action( 'admin_enqueue_scripts', array( $this, 'rpr_admin_enqueue_scripts' ), 10, 1 );
     80        }
     81
     82        public /*.void.*/ function rpr_admin_enqueue_scripts( /*.string.*/ $hook_suffix ) {
     83            wp_enqueue_style( 'jquery-ui-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/ui-lightness/jquery-ui.css', false );
     84            if ( !is_multisite() ) wp_enqueue_style( 'thickbox' );
     85            wp_enqueue_script( 'jquery' );
     86            wp_enqueue_script( 'jquery-ui-datepicker' );
     87            wp_enqueue_script( 'jquery-ui-sortable' );
     88            if ( !is_multisite() ) wp_enqueue_script( 'media-upload' );
     89            if ( !is_multisite() ) wp_enqueue_script( 'thickbox' );
    7590        }
    7691
     
    444459                                echo "\n", '<option value="hidden"', selected( $meta_field['display'], 'hidden', FALSE ), '>', __( 'Hidden Field', 'register-plus-redux' ), '</option>';
    445460                                echo "\n", '<option value="text"', selected( $meta_field['display'], 'text', FALSE ), '>', __( 'Static Text', 'register-plus-redux' ), '</option>';
     461                                echo "\n", '<option value="terms"', selected( $meta_field['display'], 'terms', FALSE ), '>', __( 'Terms', 'register-plus-redux' ), '</option>';
    446462                                echo "\n", '</select></td></tr>';
    447463       
    448464                                echo "\n", '<tr><td>', __( 'Options', 'register-plus-redux' ), '</td>';
    449                                 echo "\n", '<td><input type="text" name="options[', $index, ']" id="options[', $index, ']" value="', esc_attr( $meta_field['options'] ), '"'; if ( $meta_field['display'] != 'textbox' && $meta_field['display'] != 'select' && $meta_field['display'] != 'checkbox' && $meta_field['display'] != 'radio' ) echo ' readonly="readonly"'; echo ' style="width: 100%;" /></td></tr>';
     465                                echo "\n", '<td><input type="text" name="options[', $index, ']" id="options[', $index, ']" value="', esc_attr( $meta_field['options'] ), '"'; if ( 'textbox' !== $meta_field['display'] && 'select' !== $meta_field['display'] && 'checkbox' !== $meta_field['display'] && 'radio' !== $meta_field['display'] ) echo ' readonly="readonly"'; echo ' style="width: 100%;" /></td></tr>';
    450466       
    451467                                echo "\n", '<tr><td>', __( 'Database Key', 'register-plus-redux' ), '</td>';
     
    462478       
    463479                                echo "\n", '<tr><td>', __( 'Show Datepicker', 'register-plus-redux' ), '</td>';
    464                                 echo "\n", '<td><input type="checkbox" name="show_datepicker[', $index, ']" id="show_datepicker[', $index, ']" value="1"', checked( $meta_field['show_datepicker'], 1 ), ' ', disabled( $meta_field['display'] == 'textbox', FALSE, FALSE ), ' /></td></tr>';
     480                                echo "\n", '<td><input type="checkbox" name="show_datepicker[', $index, ']" id="show_datepicker[', $index, ']" value="1"', checked( $meta_field['show_datepicker'], 1 ), ' ', disabled( $meta_field['display'] === 'textbox', FALSE, FALSE ), ' /></td></tr>';
     481
     482                                echo "\n", '<tr><td>', __( 'Terms Content', 'register-plus-redux' ), '</td>';
     483                                echo "\n", '<td><textarea name="terms_content[', $index, ']" id="terms_content[', $index, ']" style="width: 100%; height: 160px; display: block;">', esc_textarea( $meta_field['terms_content'] ),'</textarea></td></tr>';
     484
     485                                echo "\n", '<tr><td>', __( 'Terms Agreement Text', 'register-plus-redux' ), '</td>';
     486                                echo "\n", '<td><input type="text" name="terms_agreement_text[', $index, ']" id="terms_agreement_text[', $index, ']" value="', esc_attr( $meta_field['terms_agreement_text'] ), '"'; if ( 'terms' !== $meta_field['display'] ) echo ' readonly="readonly"'; echo ' style="width: 100%;" /></td></tr>';
     487
     488                                echo "\n", '<tr><td>', __( 'Revised', 'register-plus-redux' ), '</td>';
     489                                echo "\n", '<td><input type="text" name="date_revised[', $index, ']" id="date_revised[', $index, ']" class="datepicker" value="', date( "m/d/Y", $meta_field['date_revised'] ), '"'; if ( 'terms' !== $meta_field['display'] ) echo ' readonly="readonly"'; echo ' style="width: 100%;" /></td></tr>';
    465490
    466491                                echo "\n", '<tr><td>', __( 'Actions', 'register-plus-redux' ), '</td>';
     
    840865
    841866            jQuery(document).ready(function() {
     867                jQuery(".datepicker").datepicker({
     868                    beforeShow: function(input, inst) {
     869                        if (jQuery(input).prop("readonly")) {
     870                            inst.dpDiv = jQuery('<div style="display: none;"></div>');
     871                        }
     872                    }
     873                });
     874               
    842875                jQuery(document).on("click", "#upload_custom_logo_button", function() {
    843876                    formfield = jQuery("#custom_logo_url").prop("name");
     
    13571390                            }
    13581391                        }
    1359                         $meta_field['show_datepicker'] = '0';
    13601392                        $meta_field['escape_url'] = '0';
    13611393                        $meta_field['show_on_profile'] = isset( $_POST['show_on_profile'][$index] ) ? '1' : '0';
    13621394                        $meta_field['show_on_registration'] = isset( $_POST['show_on_registration'][$index] ) ? '1' : '0';
     1395                        $meta_field['require_on_registration'] = isset( $_POST['require_on_registration'][$index] ) ? '1' : '0';
    13631396                        $meta_field['show_datepicker'] = isset( $_POST['show_datepicker'][$index] ) ? '1' : '0';
    1364                         $meta_field['require_on_registration'] = isset( $_POST['require_on_registration'][$index] ) ? '1' : '0';
     1397                        $meta_field['terms_content'] = isset( $_POST['terms_content'][$index] ) ? wp_kses_post( (string) $_POST['terms_content'][$index] ) : '';
     1398                        $meta_field['terms_agreement_text'] = isset( $_POST['terms_agreement_text'][$index] ) ? wp_kses_post( (string) $_POST['terms_agreement_text'][$index] ) : '';
     1399                        $meta_field['date_revised'] = isset( $_POST['date_revised'][$index] ) ? strtotime ( (string) $_POST['date_revised'][$index] ) : time();
    13651400                        if ( empty( $meta_field['meta_key'] ) ) {
    13661401                            $meta_field['meta_key'] = 'rpr_' . Register_Plus_Redux::sanitize_text( $meta_field['label'] );
     
    13781413                    $meta_field['display'] = '';
    13791414                    $meta_field['options'] = '';
    1380                     $meta_field['show_datepicker'] = '0';
    13811415                    $meta_field['escape_url'] = '0';
    13821416                    $meta_field['show_on_profile'] = '0';
    13831417                    $meta_field['show_on_registration'] = '0';
    13841418                    $meta_field['require_on_registration'] = '0';
     1419                    $meta_field['show_datepicker'] = '0';
     1420                    $meta_field['terms_content'] = '';
     1421                    $meta_field['terms_agreement_text'] = '';
     1422                    $meta_field['date_revised'] = time();
    13851423                    $redux_usermeta[] = $meta_field;
    13861424                }
  • register-plus-redux/trunk/rpr-login.php

    r706285 r706791  
    116116        public /*.void.*/ function rpr_register_form() {
    117117            global $register_plus_redux;
     118            $terms_exist = FALSE;
    118119            $_REQUEST = stripslashes_deep( (array) $_REQUEST );
    119120            $tabindex = absint( $register_plus_redux->rpr_get_option( 'starting_tabindex' ) );
     
    307308                echo "\n", '<p id="disclaimer-p">';
    308309                echo "\n", '<label id="disclaimer_title">', esc_html( $register_plus_redux->rpr_get_option( 'message_disclaimer_title' ) ), '</label><br />';
    309                 echo "\n", '<div name="disclaimer" id="disclaimer"">', nl2br( $register_plus_redux->rpr_get_option( 'message_disclaimer' ) ), '</div>';
     310                echo "\n", '<div id="disclaimer"">', nl2br( $register_plus_redux->rpr_get_option( 'message_disclaimer' ) ), '</div>';
    310311                if ( '1' === $register_plus_redux->rpr_get_option( 'require_disclaimer_agree' ) ) {
    311312                    echo "\n", '<label id="accept_disclaimer-label" class="accept_check" for="accept_disclaimer"><input type="checkbox" name="accept_disclaimer" id="accept_disclaimer" value="1"'; if ( !empty( $accept_disclaimer ) ) echo ' checked="checked" ';
     
    319320                echo "\n", '<p id="license-p">';
    320321                echo "\n", '<label id="license_title">', esc_html( $register_plus_redux->rpr_get_option( 'message_license_title' ) ), '</label><br />';
    321                 echo "\n", '<div name="license" id="license"">', nl2br( $register_plus_redux->rpr_get_option( 'message_license' ) ), '</div>';
     322                echo "\n", '<div id="license"">', nl2br( $register_plus_redux->rpr_get_option( 'message_license' ) ), '</div>';
    322323                if ( '1' === $register_plus_redux->rpr_get_option( 'require_license_agree' ) ) {
    323324                    echo "\n", '<label id="accept_license-label" class="accept_check" for="accept_license"><input type="checkbox" name="accept_license" id="accept_license" value="1"'; if ( !empty( $accept_license ) ) echo ' checked="checked" ';
     
    331332                echo "\n", '<p id="privacy_policy-p">';
    332333                echo "\n", '<label id="privacy_policy_title">', esc_html( $register_plus_redux->rpr_get_option( 'message_privacy_policy_title' ) ), '</label><br />';
    333                 echo "\n", '<div name="privacy_policy" id="privacy_policy">', nl2br( $register_plus_redux->rpr_get_option( 'message_privacy_policy' ) ), '</div>';
     334                echo "\n", '<div id="privacy_policy">', nl2br( $register_plus_redux->rpr_get_option( 'message_privacy_policy' ) ), '</div>';
    334335                if ( '1' === $register_plus_redux->rpr_get_option( 'require_privacy_policy_agree' ) ) {
    335336                    echo "\n", '<label id="accept_privacy_policy-label" class="accept_check" for="accept_privacy_policy"><input type="checkbox" name="accept_privacy_policy" id="accept_privacy_policy" value="1"'; if ( !empty( $accept_privacy_policy ) ) echo ' checked="checked" ';
     
    338339                }
    339340                echo "\n", '</p>';
     341            }
     342            if ( is_array( $redux_usermeta ) ) {
     343                if ( !$terms_exist ) {
     344                    foreach ( $redux_usermeta as $meta_field ) {
     345                        if ( 'terms' === $meta_field['display'] ) {
     346                            $terms_exist = TRUE;
     347                            break;
     348                        }
     349                    }
     350                }
     351                if ( $terms_exist ) {
     352                    foreach ( $redux_usermeta as $meta_field ) {
     353                        if ( 'terms' === $meta_field['display'] && '1' === $meta_field['show_on_registration'] ) {
     354                            $meta_value = isset( $_REQUEST[$meta_key] ) ? (string) $_REQUEST[$meta_key] : 'N';
     355                            $meta_key = (string) esc_attr( $meta_field['meta_key'] );
     356                            echo "\n", '<p id="', $meta_key, '-p">';
     357                            echo "\n", '<label id="', $meta_key, '-label">', esc_html( $meta_field['label'] ), '</label><br />';
     358                            echo "\n", '<span id="', $meta_key, '-content">', nl2br( $meta_field['terms_content'] ), '</span>';
     359                            if ( '1' === $meta_field['require_on_registration'] ) {
     360                                echo "\n", '<label id="accept_', $meta_key, '-label" class="accept_check" for="', $meta_key, '"><input type="checkbox" name="', $meta_key, '" id="', $meta_key, '" value="Y"', checked( $meta_value, 'Y' ), ' ';
     361                                if ( 0 !== $tabindex ) echo 'tabindex="', $tabindex++, '" ';
     362                                echo '/>&nbsp;', esc_html( $meta_field['terms_agreement_text'] ), '</label>';
     363                            }
     364                            echo "\n", '</p>';
     365                        }
     366                    }
     367                }
    340368            }
    341369        }
     
    580608            if ( is_array( $redux_usermeta ) ) {
    581609                foreach ( $redux_usermeta as $meta_field ) {
    582                     if ( !empty( $meta_field['show_on_registration'] ) ) {
     610                    if ( '1' === $meta_field['show_on_registration'] ) {
    583611                        if ( 'checkbox' === $meta_field['display'] ) {
    584612                            $meta_value = isset( $source[ (string) $meta_field['meta_key']] ) ? (array) $source[ (string) $meta_field['meta_key']] : '';
    585613                        }
     614                        else if ( 'terms' === $meta_field['display'] ) {
     615                            $meta_value = isset( $source[ (string) $meta_field['meta_key']] ) ? (string) $source[ (string) $meta_field['meta_key']] : 'N';
     616                        }
    586617                        else {
    587618                            $meta_value = isset( $source[ (string) $meta_field['meta_key']] ) ? (string) $source[ (string) $meta_field['meta_key']] : '';
    588619                        }
    589                         if ( !empty( $meta_value ) ) {
    590                             $register_plus_redux->rpr_update_user_meta( $user_id, $meta_field, $meta_value );
    591                         }
     620                        $register_plus_redux->rpr_update_user_meta( $user_id, $meta_field, $meta_value );
    592621                    }
    593622                }
     
    690719                            if ( 'textarea' === $meta_field['display'] ) {
    691720                                if ( empty( $show_custom_textarea_fields ) )
    692                                     $show_custom_textarea_fields = '#' . $meta_key . '-label';
     721                                    $show_custom_textarea_fields = '#' . $meta_key;
    693722                                else
    694                                     $show_custom_textarea_fields .= ', #' . $meta_key . '-label';
     723                                    $show_custom_textarea_fields .= ', #' . $meta_key;
    695724                            }
    696725                            if ( 'text' === $meta_field['display'] ) {
    697                                 if ( empty( $show_custom_textarea_fields ) )
     726                                if ( empty( $show_custom_text_fields ) )
    698727                                    $show_custom_text_fields = '#login form #' . $meta_key . '-p';
    699728                                else
     
    718747                    if ( !empty( $show_fields ) ) echo "\n", $show_fields, ' { font-size:24px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
    719748                    if ( is_array( $register_plus_redux->rpr_get_option( 'show_fields' ) ) && in_array( 'about', $register_plus_redux->rpr_get_option( 'show_fields' ) ) )  {
    720                         echo "\n", '#description { font-size:24px; height: 60px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
     749                        echo "\n", '#description { font-size:18px; height: 60px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
    721750                        echo "\n", '#description_msg { font-size: smaller; }';
    722751                    }
     
    725754                    if ( !empty( $show_custom_checkbox_fields ) ) echo "\n", $show_custom_checkbox_fields, ' { font-size:18px; }';
    726755                    if ( !empty( $show_custom_radio_fields ) ) echo "\n", $show_custom_radio_fields, ' { font-size:18px; }';
    727                     if ( !empty( $show_custom_textarea_fields ) ) echo "\n", $show_custom_textarea_fields, ' { font-size:24px; height: 60px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
     756                    if ( !empty( $show_custom_textarea_fields ) ) echo "\n", $show_custom_textarea_fields, ' { font-size:18px; height: 60px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
    728757                    if ( !empty( $show_custom_text_fields ) ) echo "\n", $show_custom_text_fields, ' { font-size: larger; color: #777; margin-bottom:16px; }';
    729758                    if ( '1' === $register_plus_redux->rpr_get_option( 'user_set_password' ) ) echo "\n", '#pass1, #pass2 { font-size:24px; width:100%; padding:3px; margin-top:2px; margin-right:6px; margin-bottom:16px; border:1px solid #e5e5e5; background:#fbfbfb; }';
  • register-plus-redux/trunk/rpr-signup.php

    r706743 r706791  
    331331                $accept_disclaimer = isset( $_REQUEST['accept_disclaimer'] ) ? '1' : '0';
    332332                echo "\n", '<label id="disclaimer-label" for="disclaimer">', esc_html( $register_plus_redux->rpr_get_option( 'message_disclaimer_title' ) ), ':</label>';
    333                 echo "\n", '<div name="disclaimer" id="disclaimer" style="display: inline;">', nl2br( $register_plus_redux->rpr_get_option( 'message_disclaimer' ) ), '</div>';
     333                echo "\n", '<div id="disclaimer" style="display: inline;">', nl2br( $register_plus_redux->rpr_get_option( 'message_disclaimer' ) ), '</div>';
    334334                if ( '1' === $register_plus_redux->rpr_get_option( 'require_disclaimer_agree' ) ) {
    335335                    echo "\n", '<label id="accept_disclaimer-label"><input type="checkbox" name="accept_disclaimer" id="accept_disclaimer" value="1"'; if ( $accept_disclaimer ) echo ' checked="checked"'; echo ' />&nbsp;', esc_html( $register_plus_redux->rpr_get_option( 'message_disclaimer_agree' ) ), '</label>';
     
    342342                $accept_license = isset( $_REQUEST['accept_license'] ) ? '1' : '0';
    343343                echo "\n", '<label id="license-label" for="license">', esc_html( $register_plus_redux->rpr_get_option( 'message_license_title' ) ), ':</label>';
    344                 echo "\n", '<div name="license" id="license" style="display: inline;">', nl2br( $register_plus_redux->rpr_get_option( 'message_license' ) ), '</div>';
     344                echo "\n", '<div id="license" style="display: inline;">', nl2br( $register_plus_redux->rpr_get_option( 'message_license' ) ), '</div>';
    345345                if ( '1' === $register_plus_redux->rpr_get_option( 'require_license_agree' ) ) {
    346346                    echo "\n", '<label id="accept_license-label"><input type="checkbox" name="accept_license" id="accept_license" value="1"'; if ( $accept_license ) echo ' checked="checked"'; echo ' />&nbsp;', esc_html( $register_plus_redux->rpr_get_option( 'message_license_agree' ) ), '</label>';
     
    353353                $accept_privacy_policy = isset( $_REQUEST['accept_privacy_policy'] ) ? '1' : '0';
    354354                echo "\n", '<label id="privacy_policy-label" for="privacy_policy">', esc_html( $register_plus_redux->rpr_get_option( 'message_privacy_policy_title' ) ), ':</label>';
    355                 echo "\n", '<div name="privacy_policy" id="privacy_policy" style="display: inline;">', nl2br( $register_plus_redux->rpr_get_option( 'message_privacy_policy' ) ), '</div>';
     355                echo "\n", '<div id="privacy_policy" style="display: inline;">', nl2br( $register_plus_redux->rpr_get_option( 'message_privacy_policy' ) ), '</div>';
    356356                if ( '1' === $register_plus_redux->rpr_get_option( 'require_privacy_policy_agree' ) ) {
    357357                    echo "\n", '<label id="accept_privacy_policy-label"><input type="checkbox" name="accept_privacy_policy" id="accept_privacy_policy" value="1"'; if ( $accept_privacy_policy ) echo ' checked="checked"'; echo ' />&nbsp;', esc_html( $register_plus_redux->rpr_get_option( 'message_privacy_policy_agree' ) ), '</label>';
     
    359359                if ( $errmsg = $errors->get_error_message('privacy_policy') ) {
    360360                    echo '<p class="error">', $errmsg, '</p>';
     361                }
     362            }
     363            if ( is_array( $redux_usermeta ) ) {
     364                if ( !$terms_exist ) {
     365                    foreach ( $redux_usermeta as $meta_field ) {
     366                        if ( 'terms' === $meta_field['display'] ) {
     367                            $terms_exist = TRUE;
     368                            break;
     369                        }
     370                    }
     371                }
     372                if ( $terms_exist ) {
     373                    foreach ( $redux_usermeta as $meta_field ) {
     374                        if ( 'terms' === $meta_field['display'] && '1' === $meta_field['show_on_registration'] ) {
     375                            $meta_value = isset( $_REQUEST[$meta_key] ) ? (string) $_REQUEST[$meta_key] : 'N';
     376                            $meta_key = (string) esc_attr( $meta_field['meta_key'] );
     377                            echo "\n", '<label id="', $meta_key, '-label">', esc_html( $meta_field['label'] ), '</label><br />';
     378                            echo "\n", '<div id="', $meta_key, '-content" style="display: inline;">', nl2br( $meta_field['terms_content'] ), '</div>';
     379                            if ( '1' === $meta_field['require_on_registration'] ) {
     380                                echo "\n", '<label id="accept_', $meta_key, '-label"><input type="checkbox" name="', $meta_key, '" id="', $meta_key, '" value="Y"', checked( $meta_value, 'Y' ), ' />&nbsp;', esc_html( $meta_field['terms_agreement_text'] ), '</label>';
     381                            }
     382                            if ( $errmsg = $errors->get_error_message($meta_key) ) {
     383                                echo '<p class="error">', $errmsg, '</p>';
     384                            }
     385                        }
     386                    }
    361387                }
    362388            }
Note: See TracChangeset for help on using the changeset viewer.