Here's a patch which adds user tokens for substitution. The big advantage for this is that when #125640: Add profile support over in token gets finished, you can do neat things like "Dear [profile_personal_first_name]" for customized emails.

Enjoy!
--Andrew

Comments

dww’s picture

Status: Needs review » Needs work
StatusFileSize
new2.95 KB

Thanks for the patch, this will be very useful. Amazingly, this still applies after #290734: Cleanup, unify and fix hard-coded signup email tokens. ;)

Visual inspection looks great. Light testing mostly seems fine.

However, the original bug from #290734, namely that %username wasn't handled properly for anonymous users, is a problem here, too. I'm not sure if there's ANYTHING we can do about that, other than perhaps update the help text somehow. :( Basically, any user tokens you put in a message end up empty for any anonymous signups. E.g. I have a test site with a node that has both auth and anon signups. I did a broadcast with the following body:

You signed up for %event ([url])
You registered for this site on [reg-date]

The resulting email looks like this for auth:

You signed up for test gig (http://example.com/node/164)
You registered for this site on Fri, 08/01/2008 - 05:58

But it looks like this for the anon signups:

You signed up for test gig (http://example.com/node/164)
You registered for this site on

Utterly expected behavior (for me, the developer looking at this patch), but probably going to confuse and annoy end users.

Maybe the "Replacement tokens" fieldset should be split up into two lists, and we have some warning text before we list all the user tokens that says something like:

"Warning: the following replacement tokens will only have values for authenticated users that signed up. If your site allows anonymous users to signup, all of these tokens will be empty in the resulting message for those users."

??

I did that in the attached patch, but I don't think it really works. :( The warning message is easily lost in the huge list of tokens. :( Maybe we need separate fieldsets for the two kinds of tokens so it's more obvious? That'd unfortunately require a bigger patch.

Any other thoughts on what to do about this?

deviantintegral’s picture

Yes, I ran into this too. What about having two fields for confirmation and reminders - one for anonymous users, one for authenticated users? There could be an on-by-default option to keep them the same. That would allow something like a salutation to be customized, ie "Dear [username]," and "Dear valued customer," easily per-site or per node. In your case, you could even replace the "you registered" with "please register".

--Andrew

dww’s picture

Separate fields for anon + auth seems a little out of scope for this issue. Probably something to consider for #290305: Split out email functionality into separate submodule(s). I'm really not happy with how all the email stuff is being handled now, and splitting up the fields seems like it's just going to make a bad situation worse, unless it's done in the context of a deeper reorganization/rewrite.

I'm tempted to mark this "postponed", but I hate to prevent useful functionality (with very little cost) for sites without anon signups just because things get weird on sites that allow anon signups. Hrm.

dww’s picture

No longer applies after #549646: Expose signup-related node and signup values to token.module. Still not sure what to do about this, but I'm leaning towards committing it anyway and leaving things a bit wonky for sites that allow anonymous. :/

dww’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev
deviantintegral’s picture

I have the feeling that the multitude of fields for this issue could use the same solution as the Signup Status module, whatever that ends up being.

Does anyone have any solutions *other* then two fields for handling this?

tevih’s picture

Status: Needs work » Active

Seems that the tokens are available, however, they do not work as they should.

[user-name] - sends out an emails to *all signups* with a currently logged in user's user name! So, everybody is seeing "Anthony Hopkins" in their email if he is currently logged in (and beginning with "A" he's at the top of the list)

[realname] - Sends out emails to everybody with the Realname of the person who *created* the signup, not the person who's receiving the email.

qler’s picture

*subs*

adamdicarlo’s picture

StatusFileSize
new1.17 KB

This patch adds user tokens. I've tested it with content_profile, with its content_profile_tokens module enabled.

This is a really simple patch that doesn't do anything to try to handle anonymous users or users without content profiles.

adamdicarlo’s picture

Status: Active » Needs review
ambereyes’s picture

Is it possible to get the original patch for the current version 6 dev?

adamdicarlo’s picture

Version: 6.x-1.x-dev » 6.x-1.0
StatusFileSize
new1.96 KB

New version of my patch in #9 that also adds the tokens to reminder emails, which #9 didn't.

Rolled off of 6.x-1.0.

djdevin’s picture

StatusFileSize
new3.45 KB

Expanded on the patch, there were still some missing places where token_replace didn't get the user.

djdevin’s picture

StatusFileSize
new3.45 KB
p2252’s picture

Issue summary: View changes

For tokens in reminder mails #14 didn't work for me, so I used the code in patch #12, for some reason the uid doesn't work to load the tokens in reminder mails.