• Resolved fullfatdesigns

    (@fullfatdesigns)


    Hi

    I’m using Theme my Login 7.1.1 and using this documentation;

    doc link

    I’ve added the following code to a newly added theme-my-login-custom.php file I’ve created in /wp-content/plugins and added the <?php at the top;

    
    function add_tml_registration_form_fields() {
    	tml_add_form_field( 'register', 'pharmacy_name', array(
    		'type'     => 'text',
    		'label'    => 'Pharmacy Name',
    		'value'    => tml_get_request_value( 'pharmacy_name', 'post' ),
    		'id'       => 'pharmacy_name',
    		'priority' => 5,
    	) );
    	tml_add_form_field( 'register', 'pharmacy_banner_group', array(
    		'type'     => 'text',
    		'label'    => 'Pharmacy Banner/Group',
    		'value'    => tml_get_request_value( 'pharmacy_banner_group', 'post' ),
    		'id'       => 'pharmacy_banner_group',
    		'priority' => 5,
    	) );
    }
    add_action( 'init', 'add_tml_registration_form_fields' );
    
    function save_tml_registration_form_fields( $user_id ) {
    	if ( isset( $_POST['pharmacy_name'] ) ) {
    		update_user_meta( $user_id, 'pharmacy_name', sanitize_text_field( $_POST['pharmacy_name'] ) );
    	}
    	if ( isset( $_POST['pharmacy_banner_group'] ) ) {
    		update_user_meta( $user_id, 'pharmacy_banner_group', sanitize_text_field( $_POST['pharmacy_banner_group'] ) );
    	}
    }
    add_action( 'user_register', 'save_tml_registration_form_fields' );
    

    But the additional fields are not showing in the register page. Its a site I’ve inherited, so I’m not 100% sure how the login was setup, but I can’t figure out why they aren’t showing.

    The site is currently on a local build, so I’ve not been able to share the url, but I can put it on our development server if that helps.

    Kind Regards
    Wayne

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    Are you sure you’re viewing the TML registration form?

    Thread Starter fullfatdesigns

    (@fullfatdesigns)

    I’m wondering that too now. Sorry.

    As I’ve inherited this site and saw the theme my login plugin being used, I assumed the registration form was using the plugin. But now you’ve mentioned it, I think its something else. I will look in more details.

    Sorry to have wasted your time.

    Thread Starter fullfatdesigns

    (@fullfatdesigns)

    I’ve looked into it a bit more and the site is using WP Courseware. Looking at their docs about the registering form, it suggests Theme my Login, so I guess this is the route they went down.

    But I’m not sure how the two work together? to add the additional fields?

    Plugin Author Jeff Farthing

    (@jfarthing84)

    You can easily tell by inspecting the form in your browser. Our form, fields, and containers have class names prefixed with “tml-“.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Additional fields not showing in registration’ is closed to new replies.