• Resolved TomS Caprice

    (@tomsneddon)


    I have installed the User Registration and WPML plugin, and translated different languages for my website,
    the “Lost your password?” url always show the default language when I switch to another language, I found that problem in the
    user-registration/templates/myaccount/form-login.php in line between 142 and 144:

    <p class="user-registration-LostPassword lost_password">
       <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php echo esc_html( $labels['lost_your_password'] ); ?></a>
    </p>

    the wp_lostpassword_url() not translate for other language.

    I changed the code to fix it:

    <p class="user-registration-LostPassword lost_password">                
        <?php if(!empty( get_option( 'user_registration_myaccount_lost_password_endpoint', 'lost-password' ))){                                                             
      $endpoint_lost_password = ur_get_endpoint_url( get_option( 'user_registration_myaccount_lost_password_endpoint', 'lost-password' )); 
    }else{
      $endpoint_lost_password = wp_lostpassword_url();
    }
    ?>
       <a href="<?php echo esc_url( $endpoint_lost_password ); ?>"><?php echo esc_    html( $labels['lost_your_password'] ); ?></a>
    </p>

    Here is the difference:
    Before:
    <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>">

    After:

    <?php 
    if(!empty( get_option( 'user_registration_myaccount_lost_password_endpoint', 'lost-password' ))){                                                             
      $endpoint_lost_password = ur_get_endpoint_url( get_option( 'user_registration_myaccount_lost_password_endpoint', 'lost-password' )); 
    }else{
      $endpoint_lost_password = wp_lostpassword_url();
    }
    ?>
       <a href="<?php echo esc_url( $endpoint_lost_password ); ?>">
    • This topic was modified 3 years, 5 months ago by TomS Caprice.
  • The topic ‘lost password url not change WPML’ is closed to new replies.