It can even be easier.
method 1: create a
document at the top level. Assign it only to logged in groups and have it go directly to a logout page with [!WebLogin?webloginmode=`lo`&logouthomeid=`1`!]
method 2: create a
weblink at the top level. Assign it only to logged in groups and have it directly log user out [~doc id of your login page~]?webloginmode=lo
The should look like [~37~]?webloginmode=lo
Remove the http:// from the link box first
On mouse over it should like
http://www.domainname.tld/logout.html?webloginmode=lo
No scripts, no fuss, no muss, no chunks, no extra calls to the database, parser, or even to Santa Claus.
Additional Thought: I actually created a "Log out Page" and thought people would be fine using that. By Taking it out of the menu, but leaving it published, I now have a text link using that logout page as the landing spot. In the snippet call on the actual page, I had placed
[!WebLogin?webloginmode=`lo`&logouthomeid=`490`!]
The wonderful thing: The menu Link pointing to this non-menued, but published logout page redirects to doc 490 anyway. And the user is logged out with the session destroyed.
Its the best of both worlds, without having to edit the script -- and then remember you did it at a later date.
This results in a single click logout instead of one form the menu and then on the page, sending the user to a log out page with a message: "Y’all come back, now. Ya hear?" Not really , but you get the point