• Resolved sankova

    (@sankova)


    Hello
    I use this custom code from @champsupertramp

    add_action “” um_after_login_fields “, function () {
    if (! um_is_core_page (“login”)) return;

    if (isset ($ _SERVER [‘HTTP_REFERER’]) || isset ($ _POST [‘redirect_to’])) {

    if (isset ($ _POST [‘redirect_to’])) {
    $ redirect_to = $ _POST [‘redirect_to’];
    } anything else {
    $ redirect_to = $ _SERVER [‘HTTP_REFERER’];
    }
    echo “<input type = ‘hidden’ name = ‘redirect_to’ value = ‘”. esc_attr ($ redirect_to). “‘>”;
    }
    });

    It works perfectly, but is it possible to exclude the password reset page from this feature. When the user resets their password from this page as well, log in, the password reset page will reload. Can this be solved?

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

    (@champsupertramp)

    Hi @sankova

    That code already excludes all pages except the Login page.

    Regards,

    Thread Starter sankova

    (@sankova)

    Hi @champsupertramp,
    The code must except also page “Password reset” maybe.
    What I need to change?

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    Try this one:

    add_action(“um_after_login_fields", function () {
    if ( um_is_core_page (“login”) || um_is_core_page (“password-reset”) ){
    
       if (isset ($_SERVER[‘HTTP_REFERER’]) || isset ($_POST[‘redirect_to’]) ) {
    
         if (isset ($ _POST [‘redirect_to’])) {
             $redirect_to = $ _POST [‘redirect_to’];
         }else {
            $redirect_to = $ _SERVER [‘HTTP_REFERER’];
         }
      echo “<input type = ‘hidden’ name = ‘redirect_to’ value = ‘”. esc_attr ($redirect_to). “‘>”;
    }
    });

    Regards,

    Thread Starter sankova

    (@sankova)

    Hi @champsupertramp,

    This code doesn’t work for me.

    I can log in and stay on the current page anywhere on the site, but when the password is reset, I return to the page with the field for sending a reset link, even though the user is already logged in.

    Here а few Printscreens

    https://paste.pics/CXARI
    https://paste.pics/CXAS7
    https://paste.pics/CXASI
    https://paste.pics/CXASU
    https://paste.pics/CXAT7

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    There’s something wrong with your screenshot URLs when visiting them – there’s no screenshot displaying. Could you please check?

    Regards,

    missveronica

    (@missveronicatv)

    @champsupertramp

    Screenshots works fine for me

    Thread Starter sankova

    (@sankova)

    Hi, @champsupertramp
    I tested the screenshots and they are active.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    Please try this one.

    add_action(“um_after_login_fields", function () {
    if ( um_is_core_page (“login”) ){
    
       if (isset ($_SERVER[‘HTTP_REFERER’]) || isset ($_POST[‘redirect_to’]) ) {
    
         if (isset ($ _POST [‘redirect_to’])) {
             $redirect_to = $_POST [‘redirect_to’];
         }else {
            $redirect_to = $_SERVER [‘HTTP_REFERER’];
         }
        
         if (strpos($redirect_to, 'password-reset') !== false) {
              $redirect_to = "";
         }
    
      echo “<input type = ‘hidden’ name = ‘redirect_to’ value = ‘”. esc_attr ($redirect_to). “‘>”;
    }
    });

    Ensure that the reset password page URL has password-reset slug or change it in the above code to match your password reset page’s URL slug.

    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 sankova

    (@sankova)

    Hi, @champsupertramp

    Sorry for the late reply. The code works perfectly.

    Thanks a lot!!!

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sankova

    Thanks for letting us know.

    Regards,

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.