Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter desert-rover

    (@desert-rover)

    I will do that, thank you.

    Can you tell me what I should expect to see if it runs correctly?

    Thread Starter desert-rover

    (@desert-rover)

    thank you so much! that worked!

    Thread Starter desert-rover

    (@desert-rover)

    Here is the exact code I implemented. I know it’s something simple like too many brackets or something?

    //add first and last name to registration form
    //1. Add a new form element...
    add_action( 'register_form', 'myplugin_register_form' );
    function myplugin_register_form() {
    
        $first_name = ( ! empty( $_POST['first_name'] ) ) ? trim( $_POST['first_name'] ) : '';
    	$last_name = ( ! empty( $_POST['last_name'] ) ) ? trim( $_POST['last_name'] ) : '';
    
            ?>
            <p>
                <label for="first_name"><?php _e( 'First Name', 'mydomain' ) ?><br />
                    <input type="text" name="first_name" id="first_name" class="input" value="<?php echo esc_attr( wp_unslash( $first_name ) ); ?>" size="25" /></label>
            </p>
             <p>
                <label for="last_name"><?php _e( 'Last Name', 'mydomain' ) ?><br />
                    <input type="text" name="last_name" id="last_name" class="input" value="<?php echo esc_attr( wp_unslash( $last_name ) ); ?>" size="25" /></label>
            </p>
            <?php
        }
    
        //2. Add validation. In this case, we make sure first_name is required.
        add_filter( 'registration_errors', 'myplugin_registration_errors', 10, 3 );
        function myplugin_registration_errors( $errors, $sanitized_user_login, $user_email ) {
    
            if ( empty( $_POST['first_name'] ) || ! empty( $_POST['first_name'] ) && trim( $_POST['first_name'] ) == '' ) {
                $errors->add( 'first_name_error', __( '<strong>ERROR</strong>: You must include a first name.', 'mydomain' ) );
    		if ( empty( $_POST['last_name'] ) || ! empty( $_POST['last_name'] ) && trim( $_POST['last_name'] ) == '' ) {
                $errors->add( 'last_name_error', __( '<strong>ERROR</strong>: You must include a last name.', 'mydomain' ) );
            }
    
            return $errors;
        }
    
        //3. Finally, save our extra registration user meta.
        add_action( 'user_register', 'myplugin_user_register' );
        function myplugin_user_register( $user_id ) {
            if ( ! empty( $_POST['first_name'] ) ) {
                update_user_meta( $user_id, 'first_name', trim( $_POST['first_name'] ) );
    		if ( ! empty( $_POST['last_name'] ) ) {
                update_user_meta( $user_id, 'last_name', trim( $_POST['last_name'] ) );
            }
    		}
    	}
    	}
    Thread Starter desert-rover

    (@desert-rover)

    I did Google it but didn’t connect WordPress to it. All makes sense now, I turned off the logging in wp-config.php. Thanks for your help!

    Thread Starter desert-rover

    (@desert-rover)

    Nevermind, I was hoping the Variations would display as bullet points, not just the attributes.

    Hey I just tried this and it’s not working. I am testing it on links in my bbpress forum replies. Is there anything I can do to make it work inside bbpress and buddypress?

    can anyone help me find a way to make it so my users can decide how they want to sort the forum? this plugin works great from an administrative end but our users are basically half in half wanting it descending vs. ascending and we can’t help but make people mad.

Viewing 7 replies - 1 through 7 (of 7 total)