Add token for site's UNIX timestamp

rkj - April 23, 2008 - 15:44
Project:Token
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

For comparison purposes (e.g. using workflow-ng's numeric comparison) it might be useful to have a token for the site's UNIX timestamp.

This very short and clean patch adds this token (called site-timestamp) to the token module.

Cheers,
Remco

AttachmentSizeStatusTest resultOperations
token-timestamp.patch843 bytesIgnoredNoneNone

#1

sammys - March 12, 2009 - 05:16
Version:5.x-1.10» 6.x-1.11

Hi,

Thanks for submitting this patch. I'm also wanting this to be added in though the version i'd like it added to is 6.x-1.x. Before this patch will be applied i'm pretty sure they'll want the equals sign '=' characters to line up above it. Could you reroll the patch for that?

Also, have a look at the use of the format_date() function in the patch i'm attaching for the D6 version. Since it's already being used in the D6 version perhaps you can backport all the other tokens (if they aren't already).

I'm going to bump it to the D6 version and then we can backport to the D5 version.

IMPORTANT: This token is needed for publishing and unpublishing nodes using rules.

AttachmentSizeStatusTest resultOperations
250261_200903121611+1100.patch4.83 KBIgnoredNoneNone

#2

greggles - April 10, 2009 - 17:56
Version:6.x-1.11» 6.x-1.x-dev

This no longer applies...can you re-roll for 6.x-1.x-dev?

#3

greggles - April 10, 2009 - 17:56

Actually...maybe hold off for a little bit while I work on another token extras module...

#4

sammys - April 13, 2009 - 23:36

@greggles: Not sure what you're doing over there but it applies for me. :p

sammys@pie:~/sites/all/modules/token$ patch --dry-run -p0 < 250261_200903121611+1100.patch
patching file token.module
sammys@pie:~/sites/all/modules/token$ cvs stat token.module
===================================================================
File: token.module     Status: Up-to-date

   Working revision: 1.7.4.9
   Repository revision: 1.7.4.9 /cvs/drupal-contrib/contributions/modules/token/token.module,v
   Commit Identifier: 7bfe48b814034567
   Sticky Tag: DRUPAL-6--1 (branch: 1.7.4)
   Sticky Date: (none)
   Sticky Options: (none)

This being a system level token doesn't it make sense for it to be in the main token module?

#5

sammys - April 13, 2009 - 23:45

Ok now that's weird... All those bits have been removed from 1.11. I'll let you get on with it!

#6

greggles - April 19, 2009 - 21:33
Status:needs review» fixed

Fixed in #437842: create a token starterkit module and documentation so people know how to use it.

If you can review that and make sure it works that would be great. Thanks!

#7

sammys - April 26, 2009 - 23:28

@greggles: The starterkit module is a good idea as tokens can be daunting for noobs. However, adding the timestamp token to it means you have to install the starterkit module in order to make available a site-wide token. It doesn't make sense to do that since it's an example module and the timestamp is a valid non-example token.

#8

greggles - April 27, 2009 - 01:25

@sammys - I definitely see where you're coming from and struggled with this point for a bit. Ultimately, though, there is a penalty in UI and performance to jamming every last token into token core so token starter kit is a combination of "help noobs" and "random, less useful token dumping ground."

We can argue which tokens are more or less important for a long time - so far I'm going to use my best sense of it. Having two people request this feature over the 2 years since token was created ranks it pretty low in importance, in my opinion.

#9

sammys - April 27, 2009 - 14:59

Yep ok. Thanks for the info.

#10

System Message - May 11, 2009 - 15:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.