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

2techchicks's avatar
2techchicks
49 posts
17 years ago
2techchicks's avatar 2techchicks

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

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

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

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

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.

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

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

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

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.

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

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

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

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.

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

Yep sounds like a good idea. Give it a go and see 😉

Hopefully should do what you want?

Also this is not the only way of using or should I say programming this plugin but just one of the ways. I think that once you have seen it working once and the way that it does what it does then you should definitely be able to get what you need with this.

Keep me informed on your progress though.

Speak to you soon.

Best wishes,

Mark

       
Caleydon's avatar
Caleydon
17 posts
17 years ago
Caleydon's avatar Caleydon

I’am testing this hardcode

{if segment_1 == ""}
{exp:logout_redirect url="http://www.domain.com/" text="Logout" styles="class="logout-link-class"} 
{if:elseif segment_2 == ""}
{exp:logout_redirect url="http://www.domain.com/{segment_1}" text="Logout" styles="class="logout-link-class"} 
{if:elseif segment_3 == ""}
{exp:logout_redirect url="http://www.domain.com/{segment_1}/{segment_2}" text="Logout" styles="class="logout-link-class"} 
{if:elseif segment_4 == ""}
{exp:logout_redirect url="http://www.domain.com/{segment_1}/{segment_2}/{segment_3}" text="Logout" styles="class="logout-link-class"} 
{if:elseif segment_5 == ""}
{exp:logout_redirect url="http://www.domain.com/{segment_1}/{segment_2}/{segment_3}/{segment_4}" text="Logout" styles="class="logout-link-class"} 
{if:elseif segment_6 == ""}
{exp:logout_redirect url="http://www.domain.com/{segment_1}/{segment_2}/{segment_3}/{segment_4}/{segment_5}" text="Logout" styles="class="logout-link-class"} 
{if:else}
{exp:logout_redirect url="http://www.domain.com/{segment_1}/{segment_2}/{segment_3}/{segment_4}/{segment_5}/{segment_6}" text="Logout" styles="class="logout-link-class"} 
{/if}

It’s work, but redirected URL has “//////” at the end

       
Caleydon's avatar
Caleydon
17 posts
17 years ago
Caleydon's avatar Caleydon
{if logged_in}
{exp:logout_redirect url="<?=substr($_SERVER['PHP_SELF'],10)?>" text="Logout" styles="title='Logout user' class='logout-link-class'"}
{/if}

That’s exactly what I’m looking for :)

       
Cem Meric's avatar
Cem Meric
210 posts
17 years ago
Cem Meric's avatar Cem Meric

Hi Mark, first of all thank you for the extension and keep up the good work.

I have a small issue about using the redirect more than once.

e.g.

{if logged_in}
{if member_group == "1"}
{exp:logout_redirect url="http://www.yahoo.com" text="yahoo.com" styles="class='logout' title='Logout to yahoo.com'"}
{/if}
{/if} 
{if logged_in}
{if member_group == "8"}
{exp:logout_redirect url="http://www.google.com" text="google.com" styles="class='logout' title='Logout to google.com'"}
{/if}
{/if}

also

{if logged_in}
{if member_group == "1"}
{exp:logout_redirect url="http://www.yahoo.com" text="yahoo.com" styles="class='logout' title='Logout to yahoo.com'"}
{if:else}
{exp:logout_redirect url="http://www.google.com" text="google.com" styles="class='logout' title='Logout to google.com'"}
{/if}
{/if}

On both occasion, user is redirected to http://www.google.com and what’s more interesting is their logout text is displayed correctly! So, for “Super Admin” they see “yahoo.com” for logout and for member_group == “8” or else they see google.com.

Any ideas?

       
Clearpeak's avatar
Clearpeak
413 posts
17 years ago
Clearpeak's avatar Clearpeak

Hi Mark,

Would it be possible to use this extension if your logout link was an image like:

<a href="http://{path=logout}">/images/gcn/bu_memberlogout.gif</a>

Thanks

       
JCI's avatar
JCI
144 posts
17 years ago
JCI's avatar JCI

Hey Mark… quick update.

I’ve just installed this extension and plugin and all works wonderful with one exception. Upon enabling the extension, I get the following error:

Notice: Undefined variable: default_settings in /Volumes/A/WebSites/jcicms.com/jciads/backend/extensions/ext.logout_redirect.php on line 51

Notice: Undefined variable: sql in /Volumes/A/WebSites/jcicms.com/jciads/backend/extensions/ext.logout_redirect.php on line 66

Warning: Invalid argument supplied for foreach() in /Volumes/A/WebSites/jcicms.com/jciads/backend/extensions/ext.logout_redirect.php on line 66

Warning: Cannot modify header information - headers already sent by (output started at /Volumes/A/WebSites/jcicms.com/jciads/backend/extensions/ext.logout_redirect.php:51) in /Volumes/A/WebSites/jcicms.com/jciads/backend/core/core.functions.php on line 296

The extension still works as it should without problems, and shows as being enabled, I just get the error on initial enabling. Should we be concerned? I’m running EE 1.6.3 with no mods or hacks as I’m starting a new project.

Also, one more question… can this be used in conjunction with your FetchURI extension?

Thanks.

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
17 years ago
Deron Sizemore's avatar Deron Sizemore

Mark,

I’m getting the same message that JCI is getting above when enabling the extension.

Also, I can’t get it to work either. I’ve copied/pasted your exact example code in the first post in this thread and here is the URL it keeps wanting to redirect me too:

http://www.kentuckygolfing.com/?ACT=10

This happens even though the URL I’m specifying to redirect too is “http://www.yahoo.com” as your example demonstrates.

Any ideas on what’s happening here?

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

Hmm,

Not good. Just tried it myself on the new version 1.6.3 of ExpressionEngine and indeed it does seem that there is something going on here. I had originally written this for 1.6.1 I think and so there must be something different somewhere due to the upgrades. I will have a look at this if I get any time soon. Pretty busy at the moment though and as I’m not really a coder I’m not entirely certain I will know what is up. Will take a look though but I may have to get some developer support on this one as I’m not really too sure why it would suddenly stop working like that.

Sorry about this. Will take a look as soon as I can.

Best wishes,

Mark

       
1 2 3 4 5

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.