Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1107 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

[wordpress] Rewriting logout URL to /logout/[id]

Thread title: [wordpress] Rewriting logout URL to /logout/[id]
Closed Thread    
    Thread tools Search this thread Display Modes  
12-18-2008, 11:11 AM
#1
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 3,164
iTrader: 15 / 86%
 

Dan is an unknown quantity at this point

  Old  [wordpress] Rewriting logout URL to /logout/[id]

Hey guys!

I'm trying to rewrite the logout URL to "logout/[id]", i've managed to do this pretty easy with:

RewriteRule ^logout/(.*)$ /wp-login.php?action=logout&redirect_to=/&_wpnonce=$1 [L]
However now i'm trying to display the logout link, at the moment my code is:
Code:
<?php $uri = wp_nonce_url( site_url("logout/", 'login'), 'log-out' ); ?>
<li class="logout"><a href="<?php echo $uri;?>" title="Logout"><span>Logout</span></a></li>
Which renders the logout URL as:
http://website.com/logout/?_wpnonce=[ID]

But what i need is:
http://website.com/logout/[ID]

Any suggestions?

12-18-2008, 07:16 PM
#2
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

I haven't tried it, but a quick look at the wp_nonce_url source code and some jiggling around and here's what came out:
PHP Code:
$url wp_specialchars(site_url('logout/'.wp_create_nonce('log-out'), 'login')); 

12-18-2008, 08:06 PM
#3
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 3,164
iTrader: 15 / 86%
 

Dan is an unknown quantity at this point

  Old

Thanks Salathe,

But I'm afraid it didn't output anything. :-(

12-18-2008, 08:12 PM
#4
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

Sorry, I wrote $url rather than your variable name $uri.

12-18-2008, 08:44 PM
#5
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 3,164
iTrader: 15 / 86%
 

Dan is an unknown quantity at this point

  Old

Cheers Salathe,

I should of spotted that error, sorry.

Worked a treat btw!

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed