[pmwiki-users] write ptv to profiles page is a user logout

Hans design5 at softflow.co.uk
Thu Mar 5 13:03:15 CST 2009


Thursday, March 5, 2009, 10:56:55 AM, noskule wrote:

> hi list
> has anyone a solution to write a ptv (timestamp) to the users profile 
> page if the user logs out?

> I would like to use this ptv to create "new since last logout"  pagelists.

a solution using fox:
you could have  a logout  link which opens a page with  a logout form,
basically  a button and a text asking the user to confirnm the logout.
The form itself is a Fox form to update the ptv on the profiles page
with the time stamp. The form will also have a  redirect=  parameter
with a full page url plus ?action=logout, to trigger the actual
logout after the form process, i.e. after the ptv is updated.

The Fox form would look something like this:

(:if equal {$Author} '':)not logged in(:else:)
(:fox logoutform redirect='{$ScriptUrl}?n={*$FullName}?action=logout' :)
(:foxptv Profiles.{$Author} ptvfields=LogoutTime :)
(:input hidden LogoutTime '{$$(ftime %s now)}':)
(:input submit post "Logout":)
(:foxend logoutform:)(:if:)

You may want to use {$AuthId} rather than {$Author}.
Note that we cannot use a foxsuccess message, as we use a redirect.
So to show a message I used a conditional.
The ptv is called 'LogoutTime'.
The time is written as unix timestamp

  ~Hans




More information about the pmwiki-users mailing list