We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Redirect on Login

How Do I?

avori's avatar
avori
60 posts
11 months ago
avori's avatar avori

Hello,

In the project I’m working on, I have a comments section on by blog posts. And I want only members to be able to leave comments. So if the visitor is not logged in, I have prompt with a link asking them to login to leave a comment. Which opens up the login page /auth/login.

After the person logs in, I want them to be redirected back to the previous page they were on. The exp:member:login_form return=”” only allows you to send them to a predetermined page.

Is there a way to have the form send them back to the page they navigated to the form page from? Or should I perhaps just put the form in a popup window to avoid the whole links and redirects?

Thanks, Viktor

       
Rob Allen's avatar
Rob Allen
3,102 posts
11 months ago
Rob Allen's avatar Rob Allen

I’d put a login form on the comments page itself and redirect to return="{current_url}"

👍 1
       
hygienistfree's avatar
hygienistfree
2 posts
6 months ago
hygienistfree's avatar hygienistfree

Thanks for the solution

       
Thatest's avatar
Thatest
1 posts
about 6 months ago
Thatest's avatar Thatest

If you prefer to avoid handling redirects, you can use a popup window for the login form. This way, the user remains on the same page, and after logging in, the popup can close, and the main page can refresh to reflect the logged-in state.

void(0);”]Login to leave a comment

[removed] function openLoginPopup() { var loginWindow = window.open(‘/auth/login’, ‘Login’, ‘width=600,height=400’); loginWindow.onunload = function() { location.reload(); }; } [removed]

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.