• So I’ve been trying to get things up and ready and so far so good but now when I want to add custom fields they work fine on the register-form.php and they do seem to get posted to the actual database as they do appear under the users profile “/wp-admin/profile.php” however the additional filed in this case it would be Steam ID is no where to be found.

    I’m using the following code:

    Reigster-form.php

    <?php
    /*
    If you would like to edit this file, copy it to your current theme's directory and edit it there.
    Theme My Login will always look in your theme's directory first, before using this default template.
    */
    ?>
    <div class="login" id="theme-my-login<?php $template->the_instance(); ?>">
    	<!--<?php $template->the_action_template_message( 'register' ); ?>-->
    	<?php $template->the_errors(); ?>
    	<form name="registerform" id="registerform<?php $template->the_instance(); ?>" action="<?php $template->the_action_url( 'register' ); ?>" method="post">
    		<p>
    			<label for="user_login<?php $template->the_instance(); ?>"><?php _e( 'Username:' ); ?></label>
    			<input type="text" name="user_login" id="user_login<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_login' ); ?>" size="20" required />
    		</p>
    		<p>
    			<label for="first_name<?php $template->the_instance(); ?>"><?php _e( 'First name:' ) ?></label>
    			<input type="text" name="first_name" id="first_name<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'first_name' ); ?>" size="20" />
    		</p>
    		<p>
    			<label for="last_name<?php $template->the_instance(); ?>"><?php _e( 'Last name:' ) ?></label>
    			<input type="text" name="last_name" id="last_name<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'last_name' ); ?>" size="20" />
    		</p>
    		<p>
    			<label for="steamid<?php $template->the_instance(); ?>"><?php _e( 'Steam ID:' ) ?></label>
    			<input type="text" name="steamid" id="steamid<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'steamid' ); ?>" size="20" />
    		</p>
    		<p>
    			<label for="user_email<?php $template->the_instance(); ?>"><?php _e( 'Email address:' ); ?></label>
    			<input type="text" name="user_email" id="user_email<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_email' ); ?>" size="20" required />
    		</p>
    		<?php do_action( 'register_form' ); ?>
    		<p id="reg_passmail<?php $template->the_instance(); ?>"><?php echo apply_filters( 'tml_register_passmail_template_message', __( 'A password will be e-mailed to you.' ) ); ?></p>
    		<p class="submit">
    			<input type="submit" name="wp-submit" id="wp-submit<?php $template->the_instance(); ?>" value="<?php esc_attr_e( 'Register' ); ?>" />
    			<input type="hidden" name="redirect_to" value="<?php $template->the_redirect_url( 'register' ); ?>" />
    			<input type="hidden" name="instance" value="<?php $template->the_instance(); ?>" />
    			<input type="hidden" name="action" value="register" />
    		</p>
    	</form>
    	<?php $template->the_action_links( array( 'register' => false ) ); ?>
    </div>

    theme-my-login-custom.php

    <?php
    function tml_user_register( $user_id ) {
    	if ( !empty( $_POST['first_name'] ) )
    		update_user_meta( $user_id, 'first_name', $_POST['first_name'] );
    	if ( !empty( $_POST['last_name'] ) )
    		update_user_meta( $user_id, 'last_name', $_POST['last_name'] );
    	if ( !empty( $_POST['steamid'] ) )
    		update_user_meta( $user_id, 'steamid', $_POST['steamid'] );
    }
    add_action( 'user_register', 'tml_user_register' );
    ?>

    Like mentioned before I’m referring to the steamID, do I need to add something else so it actually appears on the profile?

    The documentation is also very confusing, it would also be a lot easier if such things could just be done in the GUI like register-plus-redux or a way to combine these two plugins as currently those two are conflicting.

    That said I hope someone could help me out with this problem as I really like to get this done as soon as possible!

    Thanks in advance.

    https://wordpress.org/plugins/theme-my-login/

The topic ‘Custom Fields on Profile?’ is closed to new replies.