Expose signup-related node and signup values to token.module

dww - August 14, 2009 - 21:38
Project:Signup
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:dww
Status:closed
Description

While working on #228159: Custom emails sent upon status change I decided it'd be nice to just use token.module for the token replacement stuff in signup_status_mailer. To do so, we need to expose some signup-related data as tokens, both node tokens (for node settings) and for 'signup' tokens (which will be supported directly by various signup-related modules) for data contained in a specific signup. Stay tuned for a patch.

#1

dww - August 14, 2009 - 21:52
Status:active» needs review

While I was at it, I simplified some code to take advantage of theme('token_help') instead of our own custom version of that.

AttachmentSize
549648-1.signup_tokens.patch 8.05 KB

#2

dww - August 14, 2009 - 21:59

In testing, I noticed that during new signups, $signup->signup_time wasn't being set. Now fixed.

AttachmentSize
549646-2.signup_tokens.patch 8.33 KB

#3

dww - August 14, 2009 - 22:04

Greggles balked at the variable named "curtime". ;) Here it is as "current_time".

AttachmentSize
549646-3.signup_tokens.patch 9.65 KB

#4

dww - August 14, 2009 - 22:20

Now with filter_xss() on the custom signup form values, just to be safe. Since these tokens are used in plain text email, check_plain() isn't really what we want (and in fact, we don't even care about filter_xss(), either). However, if other modules start using these tokens in an HTML context, better safe than sorry, especially since these are entered by end users (even anonymous visitors). Also, to be extra paranoid, I cast the signup limit value to an int. ;)

AttachmentSize
549646-4.signup_tokens.patch 9.66 KB

#5

dww - August 14, 2009 - 22:38

Upon further discussion, seems better to provide both regular and raw versions of this token, and let customers decide which to use as needed.

Also adds the attendance bit as another signup token.

AttachmentSize
549646-5.signup_tokens.patch 10.14 KB

#6

dww - August 14, 2009 - 22:44

Now with a description on the token help fieldset encouraging users to choose the -raw versions where available, since this is for ASCII email.

AttachmentSize
549646-6.signup_tokens.patch 10.51 KB

#7

dww - August 14, 2009 - 23:28
Status:needs review» fixed

Given the review(s) by greggles and more testing from me, committed to HEAD and DRUPAL-6--1.

#8

dww - August 17, 2009 - 22:19

Followup: Looking more closely at the default core tokens provided by token.module, it seems like '-' is used more frequently as the delimiter inside token names, not '_'. So, I just committed a change to switch from, e.g. [node_signup_limit] to [node-signup-limit] to both
HEAD and DRUPAL-6--1.

#9

dww - August 23, 2009 - 15:46

Follow-up: There were cases where the 'mail' field isn't inside our happy $signup object, resulting in PHP notices. Cleaned up and fixed in HEAD and DRUPAL-6--1.

#10

System Message - September 6, 2009 - 15:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.