2 of 4
2
New Extension Completed!! - Logout Redirect
Posted: 09 December 2007 10:44 AM   [ Ignore ]   [ # 19 ]  
Grad Student
Rank
Total Posts:  85
Joined  03-30-2007

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

Profile
 
 
Posted: 09 December 2007 10:51 AM   [ Ignore ]   [ # 20 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6603
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 09 December 2007 10:54 AM   [ Ignore ]   [ # 21 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6603
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 12 December 2007 07:38 AM   [ Ignore ]   [ # 22 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  184
Joined  10-24-2006

Great to see you working on this Mark!

Regarding the login redirects, I’ve been using the method described by “iain” here:
http://expressionengine.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.

 Signature 

Dabbledoo Media

———————————————————————-
Gadgetell - Tech News and Reviews
Gamertell - Gaming Hardware and Product News
Appletell - Apple News and Rumors

Profile
 
 
Posted: 12 December 2007 07:53 AM   [ Ignore ]   [ # 23 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6603
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 13 December 2007 12:51 PM   [ Ignore ]   [ # 24 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1330
Joined  02-12-2003

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

Profile
 
 
Posted: 13 December 2007 02:02 PM   [ Ignore ]   [ # 25 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6603
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 13 December 2007 02:17 PM   [ Ignore ]   [ # 26 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1330
Joined  02-12-2003

Why do you need the info to survive across pages?

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

Jamie

Profile
 
 
Posted: 13 December 2007 04:11 PM   [ Ignore ]   [ # 27 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6603
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 18 December 2007 06:42 AM   [ Ignore ]   [ # 28 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6603
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 18 December 2007 02:44 PM   [ Ignore ]   [ # 29 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1330
Joined  02-12-2003

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.  smile

Jamie

Profile
 
 
Posted: 28 December 2007 09:27 AM   [ Ignore ]   [ # 30 ]  
Grad Student
Rank
Total Posts:  77
Joined  03-30-2005

Hi Mark,

I receive this error when I try to enable the extension.  I’m using version 1.5.2.

Thanks!!

Notice: Undefined variable: default_settings in /home/thund6/public_html/site/admin/extensions/ext.logout_redirect.php on line 51

Notice: Undefined variable: sql in /home/thund6/public_html/site/admin/extensions/ext.logout_redirect.php on line 66

Warning: Invalid argument supplied for foreach() in /home/thund6/public_html/site/admin/extensions/ext.logout_redirect.php on line 66

Warning: Cannot modify header information - headers already sent by (output started at /home/thund6/public_html/site/admin/extensions/ext.logout_redirect.php:51) in /home/thund6/public_html/site/admin/core/core.functions.php on line 293

 Signature 

———————————-
Andrea Beight
2TechChicks Network

Profile
 
 
Posted: 28 December 2007 04:41 PM   [ Ignore ]   [ # 31 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6603
Joined  04-15-2006

Hi there Andrea,

Unfortunately I have never tested this extension / plugin on anything less than 1.6.1 so not entirely sure if it will work or not. I think that some of the functions that I am using are 1.6.1 specific so I think an upgrade would be needed for this to work for you.

I am away now for a few days for New Year and so won’t be at a computer for a while but when I get back I will look at making a much simpler version of this and upload it for everyone.

Sorry about that.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 26 February 2008 03:55 PM   [ Ignore ]   [ # 32 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1570
Joined  08-02-2006

Hi Mark,

Seems like a great extension, just what I need I think. I’m wondering though, can you redirect the user to the page they were on previously before clicking “logout?” I’d just like to let them to back to their previous page rather than another page like www.yahoo.com. 

I read through this thread quickly but didn’t see anything. My apologies if I overlooked this.

 Signature 

Deron Sizemore
==========
Random Jabber | Sizcons | NiceStylesheet | Kentucky Golfing | LogoGala
Twitter: Deron Sizemore | LogoGala

Profile
 
 
Posted: 27 February 2008 02:56 AM   [ Ignore ]   [ # 33 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6603
Joined  04-15-2006

Hi Deron,

Not sure if I am understanding your question correctly but let’s say you are on a page with the following kind of template / url structure :

http://www.mysite.com/my-template-group/my-template/my_url_title

If you now placed the following code on that page :

{exp:logout_redirect url="http://www.mysite.com/my-template-group/my-template/my_url_title" text="Get Me Out Now" styles="class='logout-link-class' title='Logout Link'"}

That should (I think) be doing what you are asking? The www.yahoo.com was just placed in there as an example but it can be anything you like really and seeing as how the plugin/extension code is placed on the page that you want to log out from then just placing the same url in there should take you back there again hopefully.

Hope that helps.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 27 February 2008 08:16 AM   [ Ignore ]   [ # 34 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1570
Joined  08-02-2006

Hey Mark. As I re-read the directions for using this plugin, I think I was thoroughly confused right from the start.

What I’m wanting to do is somehow redirect the user back to the page they were on before they logged out (assuming the page they where on was not a member’s only page). So, lets assume someone is already logged into my site and they are viewing the blog page (which isn’t a members only page). They click logout and are then redirected back to the blog homepage (rater than the site homepage like it does by default).

If I understand your plugin correctly (after a re-read) I simply create a new template and place

{exp:logout_redirect url=“http://www.mysite.com/my-template-group/my-template/my_url_title” text=“Get Me Out Now” styles=“class=‘logout-link-class’ title=‘Logout Link’”}

into that new template?

So, for my logout anchor link, what else do I need to make this work? For my logout link right now I’ve got something like: Logout. Do I just leave it as is or do I need to add something to it for the redirect to work?

Sorry, I’m sure this is very easy, but I just don’t seem to be understanding how this works.

 Signature 

Deron Sizemore
==========
Random Jabber | Sizcons | NiceStylesheet | Kentucky Golfing | LogoGala
Twitter: Deron Sizemore | LogoGala

Profile
 
 
Posted: 27 February 2008 08:32 AM   [ Ignore ]   [ # 35 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6603
Joined  04-15-2006

Hi Deron,

This is used instead of the standard {path=“LOGOUT”} and is meant to go in place of it.

Let’s say you have your site called :

http://www.deronsizemore.com

You then have template groups and templates set up like so :

blog-template-group/blog-details

and you have a url_title of :

my_first_blog_post

If you place :

{exp:logout_redirect url="http://www.deronsizemore.com/blog-template-group/blog-details/my_first_blog_post" text="Log out and stay on this page.” styles="class=’logout-link-class’ title=’Logout Link’"}

into your template where you want the log-out link to occur then this should log you out of EE and then return you to the same page that you are currently on. I am pretty sure you will also be able to use the {segment_1} variables instead because you wouldn’t be able to hard-code a value for the log-out link if you are on a single entry page.

Hope that helps?

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 27 February 2008 08:56 AM   [ Ignore ]   [ # 36 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1570
Joined  08-02-2006

hmmm, I’m just not wrapping my head around this concept.

The thing that is confusing to me is maybe the way I’ve got my site set up? In my header, I have the member links (login, logout, register, profile, etc.) So, if the user is logged in, no matter what page they are on, they will see the “logout” link at the top in the header. So, no matter what page they may happen to be on, if they decide to logout, they should be returned to that same page after logging out.

If I understand what you’re saying, you’re saying that I could use

{exp:logout_redirect url="http://www.deronsizemore.com/{segment_1}/{segment_2}/{segment_3}" text="Log out and stay on this page.” styles="class=’logout-link-class’ title=’Logout Link’"}

And that will return the user to the page they were on when they clicked “logout?”

If that’s true, what if they are on a page that does not have three segments? A few of my static pages only have one segment, so will having “/{segment_1}/{segment_2}/{segment_3}” in there cause a problem?

Maybe I just need to try this and see what happens. Possibly make more sense after I dig into it.

 Signature 

Deron Sizemore
==========
Random Jabber | Sizcons | NiceStylesheet | Kentucky Golfing | LogoGala
Twitter: Deron Sizemore | LogoGala

Profile
 
 
   
2 of 4
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65063 Total Logged-in Users: 49
Total Topics: 82196 Total Anonymous Users: 25
Total Replies: 441740 Total Guests: 245
Total Posts: 523936    
Members ( View Memberlist )
Newest Members:  1nvidiousjaris1skinnygirlaexermk1979Andrew_IDmdutahDanielJ8Forward GearCBlalock