WordPress.org

Ready to get started?Download WordPress

Forums

Theme My Login
[resolved] Extra fields on the registration form [Website] (4 posts)

  1. giObanii fiOri
    Member
    Posted 1 year ago #

    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/

  2. Jeff Farthing
    Member
    Plugin Author

    Posted 1 year ago #

    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’ );
  3. Imokon
    Member
    Posted 1 year ago #

    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?

  4. Jeff Farthing
    Member
    Plugin Author

    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic