Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mcoops

    (@mcoops)

    I added these fields to register-form.php and put that into my plugins directory. I also created theme-my-login-custom.php to my theme directory with the code below. Not working. Fields show up on register page but hangs when submit. Theme My Login pop up note seemed to infer that a Custom Form option was now part of the plugin settings…

    <?php

    function tml_registration_errors( $errors, $user_login ) {
    // Require “my-field”
    if ( empty( $_POST[‘first_name’] ) )
    $errors->add( ’empty_first_name’, __( ‘”First Name” is a required field!’ ) );

    if ( empty( $_POST[‘last_name’] ) )
    $errors->add( ’empty_last_name’, __( ‘”Last Name” is a required field!’ ) );

    if ( empty( $_POST[‘organization’] ) )
    $errors->add( ’empty_organization’, __( ‘”Company | Organization” is a required field!’ ) );
    }
    add_action( ‘registration_errors’, ‘tml_registration_errors’, 10, 2 );

    // Finally, this function will save the posted field to the user meta table
    function tml_new_user_registered( $user_id ) {
    if ( isset( $_POST[‘first_name’] ) )
    update_user_meta( $user_id, ‘first_name’, $_POST[‘first_name’] );

    if ( isset( $_POST[‘last_name’] ) )
    update_user_meta( $user_id, ‘last_name’, $_POST[‘last_name’] );

    if ( isset( $_POST[‘organization’] ) )
    update_user_meta( $user_id, ‘organization’, $_POST[‘organization’] );
    }
    add_action( ‘tml_new_user_registered’, ‘tml_new_user_registered’ );
    ?>

    Plugin Author Jeff Farthing

    (@jfarthing84)

    If you are using the User Moderation module, you will need to use the user_register hook instead of tml_new_user_registered.

    Thread Starter mcoops

    (@mcoops)

    I’m not using the User Moderation module. Any other ideas?

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Just noticed where you said you placed theme-my-login-custom.php. It belongs in wp-content/plugins.

    Thread Starter mcoops

    (@mcoops)

    Sorry. Checked (I said it backwards above) and it is in wp-content/plugins and register-form.php is in the child theme directory.

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

The topic ‘[Plugin: Theme My Login] Custom Form template’ is closed to new replies.