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

  • Ozie_CargileOzie_CargileMember
    edited January 2018 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/

    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.


  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    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?
  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    Thank you for the solution! Great job!


Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.