• Resolved Bhuvanendran

    (@bhuvanendran)


    Hello !
    Please help me to change order of register / login forms at login page – forms should be in reverse order : login, then register forms – where can I change their order?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @bhuvanendran

    Could you please provide a screenshot of the item that you’re trying to re-order?

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

    Thread Starter Bhuvanendran

    (@bhuvanendran)

    Hello Champ Camba!
    thank you for response – here is screenshot of form at login page – I would like to change order of registration / login forms here: https://paste.pics/BXX2Q
    Do you know how to change order of them?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @bhuvanendran

    For Register form –
    You will need to remove the action and then apply your custom function to it.

    Remove the original Login and Register buttons:
    remove_action( 'um_after_register_fields','um_add_submit_button_to_register', 1000 );

    Add your Login and Register buttons with different order.

    function um_032321_add_submit_button_to_register( $args ) {
    	$primary_btn_word = $args['primary_btn_word'];
    	/**
    	 * UM hook
    	 *
    	 * @type filter
    	 * @title um_register_form_button_one
    	 * @description Change Register Form Primary button
    	 * @input_vars
    	 * [{"var":"$primary_btn_word","type":"string","desc":"Button text"},
    	 * {"var":"$args","type":"array","desc":"Registration Form arguments"}]
    	 * @change_log
    	 * ["Since: 2.0"]
    	 * @usage
    	 * <?php add_filter( 'um_register_form_button_one', 'function_name', 10, 2 ); ?>
    	 * @example
    	 * <?php
    	 * add_filter( 'um_register_form_button_one', 'my_register_form_button_one', 10, 2 );
    	 * function my_register_form_button_one( $primary_btn_word, $args ) {
    	 *     // your code here
    	 *     return $primary_btn_word;
    	 * }
    	 * ?>
    	 */
    	$primary_btn_word = apply_filters('um_register_form_button_one', $primary_btn_word, $args );
    
    	if ( ! isset( $primary_btn_word ) || $primary_btn_word == '' ){
    		$primary_btn_word = UM()->options()->get( 'register_primary_btn_word' );
    	}
    
    	$secondary_btn_word = $args['secondary_btn_word'];
    	/**
    	 * UM hook
    	 *
    	 * @type filter
    	 * @title um_register_form_button_two
    	 * @description Change Registration Form Secondary button
    	 * @input_vars
    	 * [{"var":"$secondary_btn_word","type":"string","desc":"Button text"},
    	 * {"var":"$args","type":"array","desc":"Registration Form arguments"}]
    	 * @change_log
    	 * ["Since: 2.0"]
    	 * @usage
    	 * <?php add_filter( 'um_register_form_button_two', 'function_name', 10, 2 ); ?>
    	 * @example
    	 * <?php
    	 * add_filter( 'um_register_form_button_two', 'my_register_form_button_two', 10, 2 );
    	 * function my_register_form_button_two( $secondary_btn_word, $args ) {
    	 *     // your code here
    	 *     return $secondary_btn_word;
    	 * }
    	 * ?>
    	 */
    	$secondary_btn_word = apply_filters( 'um_register_form_button_two', $secondary_btn_word, $args );
    
    	if ( ! isset( $secondary_btn_word ) || $secondary_btn_word == '' ){
    		$secondary_btn_word = UM()->options()->get( 'register_secondary_btn_word' );
    	}
    
    	$secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('login');
    	/**
    	 * UM hook
    	 *
    	 * @type filter
    	 * @title um_register_form_button_two_url
    	 * @description Change Registration Form Secondary button URL
    	 * @input_vars
    	 * [{"var":"$secondary_btn_url","type":"string","desc":"Button URL"},
    	 * {"var":"$args","type":"array","desc":"Registration Form arguments"}]
    	 * @change_log
    	 * ["Since: 2.0"]
    	 * @usage
    	 * <?php add_filter( 'um_register_form_button_two_url', 'function_name', 10, 2 ); ?>
    	 * @example
    	 * <?php
    	 * add_filter( 'um_register_form_button_two_url', 'my_register_form_button_two_url', 10, 2 );
    	 * function my_register_form_button_two_url( $secondary_btn_url, $args ) {
    	 *     // your code here
    	 *     return $secondary_btn_url;
    	 * }
    	 * ?>
    	 */
    	$secondary_btn_url = apply_filters('um_register_form_button_two_url', $secondary_btn_url, $args ); ?>
    
    	<div class="um-col-alt">
    
    		<?php if ( isset( $args['secondary_btn'] ) && $args['secondary_btn'] != 0 ) { ?>
    
    			<div class="um-left um-half">
    				<a href="<?php echo esc_url( $secondary_btn_url ); ?>" class="um-button um-alt">
    					<?php _e( wp_unslash( $secondary_btn_word ),'ultimate-member' ); ?>
    				</a>
    			</div>
    			<div class="um-right um-half">
    		          <input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ) ?>" class="um-button" id="um-submit-btn" />
    			</div>
    
    		<?php } else { ?>
    
    			<div class="um-center">
    				<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ) ?>" class="um-button" id="um-submit-btn" />
    			</div>
    
    		<?php } ?>
    
    		<div class="um-clear"></div>
    
    	</div>
    
    	<?php
    }
    add_action( 'um_after_register_fields','um_032321_add_submit_button_to_register', 1000 );

    You can use the Code Snippets plugin to add the above.
    https://wordpress.org/plugins/code-snippets/

    Regards,

    • This reply was modified 3 years, 1 month ago by Champ Camba.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    For Login form –

    remove the action for original Login and Register buttons:
    remove_action( 'um_after_login_fields', 'um_add_submit_button_to_login', 1000 );

    Add the new buttons in different order.

    /**
     * Show the submit button
     *
     * @param $args
     */
    function um_032321_add_submit_button_to_login( $args ) {
    	/**
    	 * UM hook
    	 *
    	 * @type filter
    	 * @title um_login_form_button_one
    	 * @description Change Login Form Primary button
    	 * @input_vars
    	 * [{"var":"$primary_btn_word","type":"string","desc":"Button text"},
    	 * {"var":"$args","type":"array","desc":"Login Form arguments"}]
    	 * @change_log
    	 * ["Since: 2.0"]
    	 * @usage
    	 * <?php add_filter( 'um_login_form_button_one', 'function_name', 10, 2 ); ?>
    	 * @example
    	 * <?php
    	 * add_filter( 'um_login_form_button_one', 'my_login_form_button_one', 10, 2 );
    	 * function my_login_form_button_one( $primary_btn_word, $args ) {
    	 *     // your code here
    	 *     return $primary_btn_word;
    	 * }
    	 * ?>
    	 */
    	$primary_btn_word = apply_filters('um_login_form_button_one', $args['primary_btn_word'], $args );
    
    	if ( ! isset( $primary_btn_word ) || $primary_btn_word == '' ){
    		$primary_btn_word = UM()->options()->get( 'login_primary_btn_word' );
    	}
    
    	/**
    	 * UM hook
    	 *
    	 * @type filter
    	 * @title um_login_form_button_two
    	 * @description Change Login Form Secondary button
    	 * @input_vars
    	 * [{"var":"$secondary_btn_word","type":"string","desc":"Button text"},
    	 * {"var":"$args","type":"array","desc":"Login Form arguments"}]
    	 * @change_log
    	 * ["Since: 2.0"]
    	 * @usage
    	 * <?php add_filter( 'um_login_form_button_two', 'function_name', 10, 2 ); ?>
    	 * @example
    	 * <?php
    	 * add_filter( 'um_login_form_button_two', 'my_login_form_button_two', 10, 2 );
    	 * function my_login_form_button_two( $secondary_btn_word, $args ) {
    	 *     // your code here
    	 *     return $secondary_btn_word;
    	 * }
    	 * ?>
    	 */
    	$secondary_btn_word = apply_filters( 'um_login_form_button_two', $args['secondary_btn_word'], $args );
    
    	if ( ! isset( $secondary_btn_word ) || $secondary_btn_word == '' ){
    		$secondary_btn_word = UM()->options()->get( 'login_secondary_btn_word' );
    	}
    
    	$secondary_btn_url = ! empty( $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page( 'register' );
    	/**
    	 * UM hook
    	 *
    	 * @type filter
    	 * @title um_login_form_button_two_url
    	 * @description Change Login Form Secondary button URL
    	 * @input_vars
    	 * [{"var":"$secondary_btn_url","type":"string","desc":"Button URL"},
    	 * {"var":"$args","type":"array","desc":"Login Form arguments"}]
    	 * @change_log
    	 * ["Since: 2.0"]
    	 * @usage
    	 * <?php add_filter( 'um_login_form_button_two_url', 'function_name', 10, 2 ); ?>
    	 * @example
    	 * <?php
    	 * add_filter( 'um_login_form_button_two_url', 'my_login_form_button_two_url', 10, 2 );
    	 * function my_login_form_button_two_url( $secondary_btn_url, $args ) {
    	 *     // your code here
    	 *     return $secondary_btn_url;
    	 * }
    	 * ?>
    	 */
    	$secondary_btn_url = apply_filters( 'um_login_form_button_two_url', $secondary_btn_url, $args ); ?>
    
    	<div class="um-col-alt">
    
    		<?php if ( isset( $args['show_rememberme'] ) && $args['show_rememberme'] ) {
    			UM()->fields()->checkbox( 'rememberme', __( 'Keep me signed in', 'ultimate-member' ), false ); ?>
    			<div class="um-clear"></div>
    		<?php }
    
    		if ( isset( $args['secondary_btn'] ) && $args['secondary_btn'] != 0 ) { ?>
    
    			<div class="um-left um-half">
    			<a href="<?php echo esc_url( $secondary_btn_url ); ?>" class="um-button um-alt">
    					<?php _e( wp_unslash( $secondary_btn_word ), 'ultimate-member' ); ?>
    				</a>
    			</div>
    			<div class="um-right um-half">
    				
    	<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ); ?>" class="um-button" id="um-submit-btn" />
    			</div>
    
    		<?php } else { ?>
    
    			<div class="um-center">
    				<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ); ?>" class="um-button" id="um-submit-btn" />
    			</div>
    
    		<?php } ?>
    
    		<div class="um-clear"></div>
    
    	</div>
    
    	<?php
    }
    add_action( 'um_after_login_fields', 'um_032321_add_submit_button_to_login', 1000 );
    Thread Starter Bhuvanendran

    (@bhuvanendran)

    Dear Champ Camba, thank you for your answer!
    your solution is working – buttons in the login form are changed their order!
    That’s great!

    And today I understood that I do not need this solution – at Login button there was a link “/register/” – I changed it to “/login/” – and my forms rendered in the right order!

    So – I do appreciate your work and skills and your readiness to help!
    Thank you very much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change order of forms at login page’ is closed to new replies.