These forums are your way of communicating with the community of people developing and using tools provided by the OneAll platform. The forums are run by the community and moderated by the OneAll team during office hours.
Please stick to technical issues - and remember, no confidential information - these are public forums!

How to pass referrer URL from Social Login to another plugin using PHP?

Is there any documentation for how to pass the referrer URL from Social Login to another plugin after a user registers or logs in?

I am using OptimizeMember made by OptimizePress for Wordpress, and it absolutely overrides all redirects, sending registered and logged in users to a default page. I would like them returned to the page they registered or logged in on. Is there a way to pass the HTTP_REFERER or "current page" URL stored by Social Login to another plugin using PHP?

Best Answer

  • edited January 20 Answer ✓
    For anyone else looking for a solution to this, here's a simple hack that you can use at your own risk:

    Goto line 115 in /wp-content/plugins/optimizeMember/includes/classes/login-redirects.inc.php

    Insert this php code

    //oneall social login hack if (function_exists('oa_social_login_get_current_url')){ $redirect_to = oa_social_login_get_current_url(); if (!strpos($redirect_to, '/register') && !strpos($redirect_to, '/login')) { $url = $redirect_to; } }
    This basically hacks the login_redirection_url function of the c_ws_plugin__optimizemember_login_redirects class, making it reference the current url stored by the social login plugin during logins.

    The strpos checks are there to ensure that OptimizeMember defaults to your members page when social login redirects from the registration and login pages. You may have to change these depending on your website.

Answers

  • Hi Ozie,

    you can fully customize the redirects in the Social Login settings in your WordPress admin area.
    There is also an option to allow/forbid other plugins to override the redirect.

    Best Regards,
  • Thanks, Claude. I'm fully using these options, but they're not overriding the redirects in OptimizeMember, which is the main plugin on my site. Any thoughts on the PHP coding based option I described?
  • Thank you for the solution! Great job!
Sign In or Register to comment.