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
0 Comments
March 7, 2020

Countdown Timer

  • Madeleine was born 1 year, 7 months, 1 day ago
  • COVID-19 Work From Home 11 months, 21 days ago
  • We Become Homeowners 9 months, 26 days ago
February 2021
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
« Nov    

Recent Posts

  • Enjoying the play house at church
  • Happy First Birthday Madeleine!
  • Parental Leave Days 81 to 84
  • Parental Leave Day 80
  • Parental Leave Day 78

Recent Comments

  • Wendy Weber on Happy First Birthday Madeleine!
  • Pam Ferguson on Parental Leave Days 81 to 84
  • Christina Roethemeyer on Parental Leave Days 81 to 84
  • Pam Ferguson on Happy First Birthday Madeleine!
  • Andrew on Happy First Birthday Madeleine!

Subscribe to Our Newsletter

Get regular updates via email in one of the following increments:
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

  • 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 — 2021 - Andrew and Rachel Ferguson. All Rights Reserved.