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 Completed!! - Logout Redirect

Development and Programming

swenke's avatar
swenke
70 posts
17 years ago
swenke's avatar swenke

Mark,

Any thoughts about this.

Notice: Undefined variable: default_settings in /home/virtual/site179/fst/var/www/html/expressionEngine/system/extensions/ext.login_redirect.php on line 51

Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site179/fst/var/www/html/expressionEngine/system/extensions/ext.login_redirect.php:51) in /home/virtual/site179/fst/var/www/html/expressionEngine/system/core/core.functions.php on line 296

I cleared out the old versions and reinstalled them then went to extension manager and enabled it when it asked to confirm my action I got the above message on a white screen.

Your thoughts, Chris

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Chris,

Sorry about that. Are you using the Logout Redirect extension that I have made or the Login Redirect extension? I only ask as what you have shown above is an error with exp.login_redirect.php shown in it. The Logout Redirect extension has nothing in it that would spit out that error.

The easiest way to start again, although this involves messing with the database is to delete any rows from exp_extensions that contain Logout_redirect if it is indeed the Logout Redirect extension that you are trying to use?

Also delete the table exp_logout_redirect_url. You should then be able to try again.

Still wondering why you are getting the error message that you have there though as that says ext.login_redirect.php and shouldn’t be saying that if you are trying the Logout Redirect extension.

Hope that helps.

Best wishes,

Mark

       
swenke's avatar
swenke
70 posts
17 years ago
swenke's avatar swenke

Mark,

No need to apologize I’m just happy that their are people out in the EE community that are willing to help like this. I can only hope as my experience grows that I can begin to give back.

I figured out what I had going on, I got mixed up between Logout and Login, just got caught up doing and didn’t read.

What do think about the possibilities of wrapping the code below with your extension and making it work.

<span class="log"><a href="#">LOG-OUT</a></span>

Your thoughts, Chris

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Chris,

No problem at all. All this is really new to me too (the creating extensions I mean) and I went through tons and tons of changes until this worked. At least I hope it all works well! 😊

What exactly do you want your logout link to look like? Do you just want to wrap a span class around it. If so then I think this would probably work :

<span class="log">
{exp:logout_redirect url="http://www.yahoo.com" text="Log Out To Yahoo" styles="class='main'"}
</span>

The plugin is at the moment just a single tag and not a tag pair so in itself it can’t be wrapped around anything but the code above should get what you need if I am understanding correctly.

Hope that helps.

Best wishes,

Mark

       
swenke's avatar
swenke
70 posts
17 years ago
swenke's avatar swenke

Mark,

I feel I’m this close - It looks exactly like I want it now and it even logs me out the problem is that it still drops me back to my index and not Yahoo.

Hmm, Chris

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Chris,

Make sure that you are logging in on the user side and not the admin side of things first of all. See if that helps.

Login as a normal user using the user login form. Try to logout.

It should then re-direct you to Yahoo or wherever you have set in the URL.

Hope that helps.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Also for anyone else reading this at the moment. The extension / plugin currently works by writing the URL to a database table for that member. This is then used in the extension when the user logs out to re-direct them to where you want them to go to.

I will probably (hopefully) update this to use a cookie instead which is a little safer as there then won’t be any writing or deleting from the ExpressionEngine tables. At the moment though it writes to its own database table so there shouldn’t really be any worry there with your data but as always please do backup and test extensively before using this on any live sites, and, if in doubt, don’t use it!

Best wishes,

Mark

       
Dabbledoo's avatar
Dabbledoo
172 posts
17 years ago
Dabbledoo's avatar Dabbledoo

Great to see you working on this Mark!

Regarding the login redirects, I’ve been using the method described by “iain” here: http://ellislab.com/forums/viewthread/62282/

Seems to be a great solution except for the fact that you have to exclude those URLs in htaccess so Google doesn’t index all of your login pages.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi there Dabbledoo!

Regarding the Login Redirect I have now written up a very simple way of doing this both in the WIKI and also a forum post. Hope that is of some use to some people.

Best wishes,

Mark

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

Mark,

Few thoughts.

  1. Why not use the $SESS cache to keep the redirect URL in? Then you don’t need a table in the DB which is rather overkill for this kind of functionality.
  2. You can probably check to see if a URL given has the http:// part and add it if necessary before writing it to the the above cache. However you will also want to make sure the given URL doesn’t start with a valid template_group/template chunk. If it does you don’t want to add the http:// part obviously.

Jamie

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Jamie,

Hmm. I thought that the $SESS usage was only for on one page and couldn’t actually be used across pages to maintain state as normal sessions do? How do you store items in $SESS then to work across pages with?

Thanks.

Best wishes,

Mark

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

Why do you need the info to survive across pages?

Maybe I didn’t understand quite how you were using it.

Jamie

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Jamie,

Basically I had a plugin that allows you to set the URL that you want to be re-directed to upon logging out of the system. I was writing this to the database and then using the member_member_logout hook to log out of the system and then using the $FNS->redirect to get the user to where I wanted to send them to.

With the Login Redirect method that I have now added to the WIKI I am now handling this with a cookie on the users machine which is then used within the return=”“ parameter in the login form tag.

My problem with that one was when I made the extension I unfortunately didn’t quite understand how to program using the hooks effectively so pretty much ended up just copying most of the mod.member_auth.php into the extension and then changing the redirect to go where I wanted.

I definitely need a better understanding of how to use the hooks as I have lots of ideas that could (I think) be implemented into ExpressionEngine but I just didn’t know how to do them.

For instance with the Login Redirect extension which I made (now no longer on the forums due to licensing rules) I just wanted to change the return variable which was quite a way down the code in the php file after where the hook started but I didn’t know how to create all the same needed functions to log the person out and so that is why I ended up just taking the code from the file and adding it into the extension.

I thought that I needed the information to stay across a page as I was using a plugin to write the URL to the database and then when a person clicks on a logout link the extension kicks in and logs them out then re-directs them to the URL.

Is there an easier way and can sessions be used for maintaining state?

I would love to learn how to do this with an extension as I would really love to learn how to write them correctly.

Any help with this would be massively appreciated.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Jamie,

Was just wondering if you had any more news on this at all? Can $SESS be used to store data across a page call then?

Thanks.

Best wishes,

Mark

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

Hey Mark,

Sorry, I’ve been a bit crushed for time lately. I’m actually not quite sure. You could certainly try it and let me know. 😊

Jamie

       
1 2 3 4 Last

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.