• Resolved giObanii fiOri

    (@giobanii)


    I tried adding a field where users insert the URL of your website but this is not saved in your profile
    Here’s what I did, what am I doing wrong?

    register-form.php

    <p>
    <label for=”user_url<?php $template->the_instance(); ?>”><?php _e( ‘Website’, ‘theme-my-login’ ) ?></label>
     <input type=”text” name=”user_url” id=”user_url<?php $template->the_instance(); ?>” class=”input” value=”<?php $template->the_posted_value( ‘user_url’ ); ?>” size=”20″ tabindex=”20″ />
     </p>

    theme-my-login-custom.php.

    function tml_registration_errors( $errors ) {
    	if ( empty( $_POST['user_url'] ) )
    		$errors->add( ‘empty_user_url’, ‘ERROR: Introduzca la dirección de su página web.’ );
    	return $errors;
    }
    add_filter( ‘registration_errors’, ‘tml_registration_errors’ );
    
    function tml_user_register( $user_id ) {
    	if ( !empty( $_POST['user_url'] ) )
    		update_user_meta( $user_id, ‘user_url’, $_POST['user_url'] );
    }
    add_action( ‘user_register’, ‘tml_user_register’ );

    http://wordpress.org/extend/plugins/theme-my-login/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    User URL is stored in the users table rather than the usermeta table.

    function tml_user_register( $user_id ) {
    	if ( !empty( $_POST['user_url'] ) )
    		wp_update_user( array( 'ID' => $user_id, 'user_url' => $_POST['user_url'] ) );
    }
    add_action( ‘user_register’, ‘tml_user_register’ );

    I want to add a birth date field in the form but I want it to verify against a certain age limit (18 yrs or older type thing) so that if its the wrong age it refuses to register. Is this possible and if so what kind of fields do I need to look up? Possibly birthday fields that can’t be modified after registration, is that even possible?

    I’m not sure if this is possible right now with regular fields added to the form, if it isn’t then can I make this a request?

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Of course it is possible. If you need help implementing it, I am available for hire.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Theme My Login] Extra fields on the registration form [Website]’ is closed to new replies.