• I have been trying to add a custom field to “theme my login” (which works great btw) – but cannot get it to post. Does anyone have a sample I can refer to? Most of the links to pastebin were broken and other posts didn’t seem to have a clean example.

    Best one I found was this one: Require Other information when Registering

    There were some different references to the registration errors (using tml_registration_errors). Either way, whatever I tried, could still not get it to post.

    Below is what I pieced together to add a phone field – the reg form is in the theme directory and custom login file is the wp-content/plugins directory. I can back into it if I had a clean reference. TIA

    <p>
                <label for="user_phone<?php $template->the_instance(); ?>"><?php _e( 'Phone', 'theme-my-login' ) ?></label>
                <input type="text" name="user_phone" id="user_phone<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_phone' ); ?>" size="20" />
    </p>
    <?php
    function registration_errors( $errors ) {
    	if ( empty( $_POST['user_phone'] ) )
    		$errors->add( 'empty_user_phone', __( 'Phone is a required field!' ) );
    }
    add_action( 'registration_errors', 'registration_errors', 10, 2 );
    
    function tml_new_user_registered( $user_id ) {
    	if ( isset( $_POST['user_phone'] ) )
    		update_user_meta( $user_id, 'user_phone', $_POST['user_phone'] );
    }
    add_action( 'tml_new_user_registered', 'tml_new_user_registered' );
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • That should be right. What is the name of the file in which the second code block is contained?

    Thread Starter rt2null

    (@rt2null)

    Second code block was put in a file called: theme-my-login-custom.php and it resides in the wp-content/plugins directory.

    I tried using CIMY to add the fields, but that broke email notifications, so I am back to getting the TML custom page.

    Thanks for the help Jeff!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Theme My Login] theme-my-login-custom.php – doesn't post’ is closed to new replies.