• Resolved nirgalo

    (@nirgalo)


    Hi, I am using s2member with a BuddyPress/bbPress site. Users can subscribe to forum posts are receive notification emails when someone mentions them or reply to their forum posts. The email contains a link to the topic in question. When clicking on this link and user is not logged in, the site displays the login page. But after logging in, user is directed to the homepage and not the topic page initially referenced by the link. I have configured s2member for URL protection and protecting the root (/) of the site which is fully private. Thanks for any help on how to fix this redirection issue.

    https://wordpress.org/plugins/s2member/

Viewing 7 replies - 1 through 7 (of 7 total)
  • To have the user redirect to another page (e.g. previous one) when logging in, you’ll need to add ?redirect_to=/here-goes-the-address-you-redirect-to at the end of wp-login.php.

    You say the user is taken to the login page because your forum is protected with s2Member, but s2’s redirection would take him to the Membership Options Page. Could you explain what you have there and what behavior is? A link to one of those posts would help me see what happens.

    Thread Starter nirgalo

    (@nirgalo)

    Hi, ok I did hack things a bit, I modified header.php in my theme so if the membership page is displayed, I redirect to the login page (because I only want the login page to display), so I always get to wp-login.php without the redirect parameter. So to fix this I guess I need to append the redirect parameter to the login page I am redirecting to. Is this redirect parameter already provided to the membership page? If so I can get it from there (I mean from current URL).

    Btw, it would be great if you could add an option to your plugin to display only the login page for non-authorized visitors and not the membership page.

    Thanks for the idea, I wrote it in our feature requests list.

    Yes, you’d add that variable to the querystring of the wp-login.php URL when doing the redirection.

    If the user was sent to the Membership Options Page, you’ll have some vars available, including the URL he was trying to open. WP Admin -> s2Member -> Scripting -> Membership Options Page Variables

    I hope that helps. 🙂

    Thread Starter nirgalo

    (@nirgalo)

    Thanks a lot Cristian, I could make some code that is grabbing the seeking_uri parameter and appending ‘?redirect_to=’ to the login URL and the problem is now fixed.

    Great. 🙂

    Thread Starter nirgalo

    (@nirgalo)

    Actually the fix works but there is a nagging side effect: it seems the seeking_uri parameter is rather persistent, as when I log out It is still available and therefore the logout URL contains the redirect_to parameter. How can I nil out content of seeking_uri when I am done with it? Thanks.

    I don’t know that it persists… Maybe it’s a caching thing in your installation?

    If you show me your code, I can tell you if I find something that may be wrong with it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘No proper redirect after login when using a forum link’ is closed to new replies.