Theme my Login plugin, how to update fields

I’m using the Theme my Login plugin for a client project and I’m having trouble updating profile fields once a user has been registered;

I followed the instructions here but they didn’t seem to have any effect. If anyone could shed some light on it that would be great.

Read More

This is my current code;

register-form.php

<p>
    <input
      type="text"
      name="phone_number" 
      id="phone_number<?php $template->the_instance(); ?>" 
      class="input" 
      value="<?php $template->the_posted_value( 'phone_number' ); ?>" 
      size="20" 
      tabindex="20" 
      placeholder="Phone Number"
    />
</p>

profile-form.php

<p>
    <input 
      type="text" 
      name="phone_number" 
      id="phone_number" 
      value="<?php echo esc_attr( $profileuser->phone_number ); ?>" 
      class="regular-text" 
      placeholder="Phone Number"
    />
</p>

theme-my-login-custom.php

function tml_user_register( $user_id ) {
        // Phone Number
        if ( !empty( $_POST['phone_number'] ) )
            update_user_meta( $user_id, 'phone_number', $_POST['phone_number'] );
}
add_action( 'user_register', 'tml_user_register' );

Related posts

1 comment

Comments are closed.