Redirects to home URL every time after login/register, even if other option is selected

From last week I have a problem. Every time user logins or sign-up's from login/registration page or widget it is redirected to home page, event if I have selected custom URL or current page. It was working fine for few months and redirecting to the page I wanted.

I tried to reinstall plugin, but this didn't help. When trying to edit includes/communication.php it didn't had any effect too.
Where could I check why this is happening?

Thank you!

Best Answers

  • Expert_DojoExpert_DojoMember
    edited June 2015 Answer ✓
    Actually I found a problem.
    The problem was S2 member framework plugin. It wasn't clear because I had two separate roles in site and users with role automatically given by this plugin had redirection problem. It was tricky to identify, because when I login from user that has this role, redirect wasn't working. But when by accident I changed the role, redirect started to work.

    When I disabled the plugin, redirection starting working just fine, but still looking forward to fix this problem, because I need this plugin.
  • Chris_KruppaChris_KruppaMember
    Answer ✓
    Hi, We have used S2 but deactivated it. We are now with PMPro.

    We are using Theme My Login and it works fine for all logins except via Social Media. :-S

Answers

  • Hi,

    Just to clarify: the user is logged in, but redirected to the home page, instead of the URL he was on ?

    Regards.
  • Expert_DojoExpert_DojoMember
    edited June 2015
    Thank you for your answer!

    Yes. After the user logins he suppose to go to my selected page, but every time he is redirected to home page. Even when I changed in settings, that I want to redirect in dashboard or current page, it still goes to home url.

    When I edited includes/communication.php file and inserted echo something and exit in different places of the code, this doesn't change anything, code runs as usual (redirects to home page) even if it has to stop somewhere in the middle.

    The interesting part is that it was working just fine for few months and one day just stopped.
  • Hi,

    When you say that it was working before, maybe now another plugin is redirecting the user after login (Rules for example).
    Do you know how your setup changed over the last weeks?

    Hope this helps.
  • Expert_DojoExpert_DojoMember
    edited June 2015
    No, there is no redirection plugins or snippets in functions.php which are redirecting somewhere, I have remove them all.

    Since then I have installed only "WP Smush", "P3 plugin-performance-profiler" and "WP-optimize" plugins, but I have disabled all of them when I started having this problem and deleted them now.

    Also I have deactivated and activated "OA Social Login" plugin and after this didn't helped I reinstalled it.
  • Expert_DojoExpert_DojoMember
    edited June 2015
    Is there is any way to check why this is happening?
  • "Even when I changed in settings, that I want to redirect in dashboard or current page, it still goes to home url." : what are the Social Login settings you set?
  • Expert_DojoExpert_DojoMember
    edited June 2015
    This is the settings for register,login pages and shortcode. https://dropbox.com/s/wfaqql956bt0tor/Screen%20shot%202015-06-24%20at%2012.01.38%20PM.png?dl=0

    Do you need any other settings?
  • Thank you.
    Unfortunately these settings do work on a local install.
    Maybe you can try the URL redirection troubleshooting tips (https://codex.wordpress.org/Login_Trouble#Site_URL_Redirecting).
    Another way would be, if you are not running a live site, to set debug on.

  • Thanks Frederic_Pinel, I am answering here, because I have the same issue.

    I am using Buddypress and BBpress as well and I had issues with Theme My Login so I installed BP Login Redirect, which redirects all normal sign ins to the right place. Only when users sign up via Social Login they always to the homepage instead of a subpage.

    We also use a Multisite Network, but as users registrations are only handled on the main page, it should not be affected by it.

    Ay further idea?
  • Hi,
    @Expert_Dojo: do you also use Theme My Login ? Or any other plugin so I can try to reproduce your errors.

    Thanks.
  • No, I don't use "Theme my login", but I use many other plugins (28 plugins in total). Do you have any plugin in particular that could cause this problem together with S2 member plugin?
  • @Frederic_Pinel Do you already have an idea as a solution?
  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    edited July 2015
    Could you please open the social login settings in your WordPress admin area and click on the Autodetect and Verify" buttons?

    Both tests should display green success message. If the connection does not work properly, then the plugin will redirect the user to the homepage when he logs in.

    Please also have a look at the functions.php file of your theme. Search for the value oa_social_login and make sure that you aren't redefining the redirection urls with a custom action.
  • @Claude_Schlesser, thanks a lot for your support.

    Yes, Autodetect and Verfify show green messages. We did not update the oa_social_login with redirects.
  • Hi,
    If the user role assigned by Social Login is causing the problem, you can look at this discussion:
    https://support.oneall.com/forums/discussion/comment/1009/#Comment_1009

    Hope this helps.
  • Hi, unfortunately not. All users get redirected to homepage regardless of their role when using Social Login. But when using the normal plugin they get redirected to what we set in BP Redirect Login.

    Thanks for your enduring support. I appreciate your work and very happy using it. Will definitely recommend it further.

    Chris
  • Fred_PinelFred_PinelMember
    edited July 2015
    Hi,
    edit: this post was in to Chris Kruppa.

    We have a code change that might help (at least with one the plugin you use).

    Before we add it to our next plugin release, could you possibly try it out? (it will be added in a week or so)
    In one of our plugin files:
    (your wordpress directory)/wp-content/plugins/oa-social-login/includes/communication.php,
    add this line: $redirect_to = apply_filters ('login_redirect', $redirect_to, NULL, $user_data);, just before:
    //Filter for redirection urls if ($new_registration === true) { which should be at about line 472.

    Hope this helps.
  • Expert_DojoExpert_DojoMember
    edited July 2015
    Does this suppose to look something like this?
    //Check if url set
    if (!isset ($redirect_to) OR strlen (trim ($redirect_to)) == 0)
    {
    $redirect_to = home_url ();
    }						
    $redirect_to = apply_filters ('login_redirect', $redirect_to, NULL, $user_data);
    						
    //Filter for redirection urls
    if ($new_registration === true)
    {
    $redirect_to = apply_filters ('oa_social_login_filter_registration_redirect_url', $redirect_to, $user_data);
    }
    else
    {
    $redirect_to = apply_filters ('oa_social_login_filter_login_redirect_url', $redirect_to, $user_data);
    }
    
    I activated "S2 member framework" plugin and tried login process again, but still users with assigned role "Subscriber" or any other role from this plugin are redirected to home page, instead of the page I selected. Users with other roles that are not created by "S2 member framework" are redirected to the page I selected.
  • Fred_PinelFred_PinelMember
    edited July 2015
    Hi,
    Yes, that's correct.
    The redirection behaviour depends on how the different plugins integrate with Wordpress, and if they can "collaborate" via the standard Wordpress hooks.
    We can't promise that all plugins will work with OneAll Social Login, but we can try to hook into more standard Wordpress hooks. Apparently not enough for S2.

    Also, it is possible to change the roles attributed by Social Login, if needed.

  • It looks like that I found the problem and half solved it.
    For more info you could read and follow this thread in "S2 member framework" support forum https://wordpress.org/support/topic/problem-with-oa-social-login?replies=3
  • Hi, thanks. We'll have a look and let you know!
  • Hi,
    The link you provided shows how you can redirect logged in users with S2 Member.
    We were able to observe your current behaviour (S2 redirection works when logging in with OA Social Login, but to a fixed URL).

    The S2 Member plugin interrupts the login OA procedure just before redirection (we call all hooks for integration with other plugins), and clears filters for login redirection.
    There is not much we can do here unfortunately.


  • Thank you a lot for your help!
    I will probably try other membership plugin to see if it works together with OA.
    Big thanks again for your patient :)
  • You're welcome. Thanks for your patience too :-)
  • Expert_DojoExpert_DojoMember
    edited July 2015
    For those who are interested, I want to inform that I solve the problem using cookies.
    For more info and solution read here https://wordpress.org/support/topic/problem-with-oa-social-login?replies=13
  • Thanks for posting the link here.

Welcome!

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.