Skip to content
  • Home
  • Andrew’s Blog
  • Rachel’s Blog
  • Contact
  • Login
  • Register
Menu Close
  • Home
  • Andrew’s Blog
  • Rachel’s Blog
  • Contact
  • Login
  • Register
Andrew and Rachel

Est. 2013

House Keeping

Service Notice: Login Redirect Issue Fixed

If you tried to login to AndrewAndRachel.com, you may have noticed that you’d essentially get stuck at a “You’re now logged in page” and you had to figure out how to get back to whatever you were trying to look at.

No more!

Whenever you login now you will automatically be redirected back to the page you viewing.

As always, if you ever encounter things like this please let us know…even if they seem trivial!

Technical details

We use Cozmo’s Profile Builder Hobbyist plugin to manage the user registration and access limitations on this site. It works quite well for this little experiment, and the support has been outstanding when I’ve had questions.

For some reason though users were not being redirected back to the page they were viewing after they logged in, instead just seeing a generic “You are currently logged in as <<username>>” page:

At first I thought the wppb_cpm_redirect parameter was the issue, but I think that’s just an artifact of using the Custom Profile Menu add-on for Profile Builder. Looking a bit deeper, I did see a wppb_referer_url parameter that is set by Profile Builder and sent with the login request, so the necessary data is present to successfully redirect.

If you have the Pro version of Profile Builder (instead of the Hobbyist version, like we do) then you can use the Custom Redirect module. But it also has a lot of other features we wouldn’t use (e.g. redirect based on username, etc).

There is also a redirect_url parameter for the wppb-login shortcode, but that just defaults to the current page and not the referring page (which is what would be needed).

I’ve filed a support request ticket to clarify if redirecting after login is the intended function or not and will update this post with their response.

In the meantime, since wppb_referer_url is the data needed I’ve whipped up this little bit of code to solve the problem by hooking into WordPress’ login_redirect filter:

function fergcorp_wppbc_user_login_redirect( $url, $request ){
    if( isset( $_POST['wppb_referer_url'] ) ) {
        $url = esc_url_raw($_POST['wppb_referer_url']);
    }
    return $url;
}
add_filter( 'login_redirect', 'fergcorp_wppbc_user_login_redirect', 10, 3 );

Problem solved.

Update: 10 March 2020

In my conversations with Cozmo technical support, they were able to confirm that this functionality is currently not included in the Hobbyist version, but is included in the Pro version via the aforementioned Custom Redirect module.

Here’s the updated gist that includes my custom tweaks for Cozmo’s Profile Builder Hobbyist: https://gist.github.com/fergbrain/d3210d4c2fbe3c4c5c13d8b182ae8bd1

###

0 Comments
March 7, 2020

Countdown Timer

  • M was born 3 years, 6 months, 3 days ago
  • COVID-19 Work From Home 2 years, 10 months, 23 days ago
  • We Become Homeowners 2 years, 8 months, 28 days ago
  • J was born 1 year, 2 months, 14 days ago
January 2023
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
« Dec    

Recent Posts

  • Save the Date: Baptism on December 12
  • The Kids
  • We Are Home!
  • Hello, World
  • Let’s Get Ready To Deliver

Recent Comments

    Subscribe to Our Newsletter

    Get regular updates via email in one of the following increments:
    Select list(s):
    Note: You should only pick one list. The content is the same, it's just how frequently you get it. Weekly is delivered on Monday mornings (if there's been new posts in the last week).

    Check your inbox or spam folder to confirm your subscription.

    Archives

    • December 2021
    • November 2021
    • August 2021
    • June 2021
    • November 2020
    • July 2020
    • June 2020
    • April 2020
    • March 2020
    • February 2020
    • January 2020
    • December 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • October 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • December 2017
    • November 2017
    • October 2017
    • August 2017
    • July 2017
    • June 2017
    • April 2017
    • March 2017
    • February 2017
    • April 2016
    • January 2016
    • May 2015
    • September 2014
    • August 2014
    • July 2014
    • June 2014
    • May 2014
    • April 2014
    • June 2013
    • May 2013
    • April 2013
    • March 2013
    • February 2013
    • January 2013
    • December 2012
    • November 2012
    • October 2012
    • September 2012
    • August 2012
    • May 2012

    Categories

    • Andrew
    • Announcement
    • Baby
    • Boeing
    • Expat
    • Home Ownership
    • House Keeping
    • Life
    • Life Together
    • Photos
    • Planning
    • Rachel
    • Seen, Heard, Said
    • Technology
    • Throwback Thursday
    • Travel
    • UK 101
    • Uncategorized
    • Update
    • Video
    • Wedding
    • Work

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    Copyright © 2012 — 2023 - Andrew and Rachel Ferguson. All Rights Reserved.
     

    Loading Comments...
     

    You must be logged in to post a comment.