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

New Extension: Redirect After Login (Twomile)

Development and Programming

wecreateyou's avatar
wecreateyou
86 posts
16 years ago
wecreateyou's avatar wecreateyou

Very useful extension, Thanks for sharing it.

I was wondering if you could add variables in the redirect url like this. /users/profile/{member_id}

       
Corey Snipes's avatar
Corey Snipes
34 posts
16 years ago
Corey Snipes's avatar Corey Snipes

Hey @wecreateyou, I’m glad it’s helpful. There’s no variable parsing done prior to redirecting the user on to their destination, so that wouldn’t work. Sorry about that! You could try redirecting everyone to a special intermediate template I suppose, one that did some tag or PHP magic to parse the member ID and send them along.

       
dsloan's avatar
dsloan
48 posts
16 years ago
dsloan's avatar dsloan
@boosh: sorry for the late reply. Are you still having trouble with this? We use the htaccess/no-index-php setup on all of our site, so it’s likely not a problem with that bit. Can you tell me a little more about your setup? (EE version, type of webserver, default template group, which template is set as home page?)

I am having the opposite problem from boosh, which is most likely due to this setup, in that we do have index.php in all our URLs but instead of redirecting to index.php/account it is redirecting to /account which is breaking things. Ist there anything I can tweak in the extension, or should I try to remove the index.php from our URLs?

It worked fine by specifying “index.php/admin” in the settings, but I want to redirect to different pages for two different member types so need to specify in the return attribute on the login_form tag.

Thanks, Diarmid

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

I’m having the same issue as boosh - on devot:ee (devot-ee.com). If a user goes to the login page from the homepage it seems that the URL ends up being “http://devot-ee.com/index”, which throws an error.

To recreate (don’t use the small login link at the top - it works if you login from there, probably because you’re not coming from a login page): 1) Visit http://devot-ee.com 2) Visit http://devot-ee.com/members/login/ and login 3) See the “/index” error.

Looks like the default setting for login_destination is “site/index”. Of course, if I manually enter “http://devot-ee.com/site/index” in the URL (though not ideal), it works fine. I have strict URL’s enabled, if that helps.

I want to go to the last page visited. Is there a way to determine if the last page visited was the homepage, and just lop off any and all segments, or to make sire “site” gets added to the URL as well as “index”?

       
AreaOne's avatar
AreaOne
9 posts
16 years ago
AreaOne's avatar AreaOne

Thanks the extension, so far it works great!

–Cory

       
joshmaxrubinstein@gmail.com's avatar
[email protected]
108 posts
16 years ago
joshmaxrubinstein@gmail.com's avatar [email protected]

@mdesign

I am about to use this extension and I was wondering if you are finding any issues with the lg .htaccess extension? Or the User module by Solspace?

Thanks

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

No issues with User and I’m not using the LG htaccess extension, so I can’t speak to that one. Other than the occasional “index” error stated above, I’m not having any issues with it.

       
joshmaxrubinstein@gmail.com's avatar
[email protected]
108 posts
16 years ago
joshmaxrubinstein@gmail.com's avatar [email protected]

@mdesign I have encountered the same issue but in my situation I was able to solve it with

../template_name

to back into the directory I wanted and eliminating the index in the url.

Your situation might be more complex or even more different than I imagine?

😉

       
Andy Harris's avatar
Andy Harris
958 posts
16 years ago
Andy Harris's avatar Andy Harris

If this honored the return param (only if it existed) on the exp:member:login_form tag it would be completely ace. Is anyone attempting it already?

       
Noah Kuhn's avatar
Noah Kuhn
60 posts
16 years ago
Noah Kuhn's avatar Noah Kuhn

Working on a site where this extension has proven to be quite helpful for the user experience. There were a few shortcomings that I came across so I’m just including some changes I made in case someone else finds it helpful.

To fix the “index” issue mentioned above, at least in my situation, by putting a simple conditional into the extension.

Find the first line below and just add the second line. In the v1.1.0 extension file it’s on line 161.

$url = $SESS->tracker['2'];
if ($url == 'index') { $url = '/'; }

It was also pretty straightforward to enable “after logout, go to the previous page” functionality by adding another setting.

I added a line to the settings() function in the extension file.

$settings["logout_lastpage_destination"] = array( "s", array( "no" => "Specific Page (below)", "yes" => "Last Page Visited" ), "yes" );

Then I added the appropriate line to the language file.

,'logout_lastpage_destination' => '<strong>Logout:</strong>  After logout, go where?'

And finally I added the following code to the process_logout() function

//Check if 'logout last page' is set to yes
if ($this->settings['logout_lastpage_destination'] == "yes")
    {
        $url = $_SERVER['HTTP_REFERER'];
    }
else
    {
        $url = $this->settings["logout_destination"];
    }

Those two quick changes made this function much more useful for me.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

Nice, Noah, thanks.

       
Corey Snipes's avatar
Corey Snipes
34 posts
16 years ago
Corey Snipes's avatar Corey Snipes

Thanks Noah, these changes look really useful. We’re incorporating and testing them here on this side, and will repackage the extension with credit to you for the improvements.

       
Noah Kuhn's avatar
Noah Kuhn
60 posts
16 years ago
Noah Kuhn's avatar Noah Kuhn

No problem, it’s a very useful extension, thanks for developing it to begin with.

It is definitely a good idea to test, as I only tried it with one install, and there could certainly be some problems I didn’t foresee. It is working for me though.

Thanks again

       
Corey Snipes's avatar
Corey Snipes
34 posts
about 16 years ago
Corey Snipes's avatar Corey Snipes

We’ve released an updated version of the Redirect After Login extension. Please let us know if there are any problems.

In v 1.2.0 - January 13, 2010 you’ll find:

~ Added ‘Last Page’ handling for logout (thanks to Noah Kuhn) ~ Added fix for error related to visiting home, then login page (thanks to Noah Kuhn) ~ Cleanup of code formatting in extension file.

It’s available on project page (same URL) here:

http://www.twomile.com/services/add-on/expression-engine-redirect-after-login

       
draymond's avatar
draymond
22 posts
about 16 years ago
draymond's avatar draymond

Will this work in EE2.0? Thanks!

       
First 2 3 4 5 6

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.