Closed (fixed)
Project:
Comment Notify
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Jan 2011 at 16:56 UTC
Updated:
22 Sep 2011 at 18:31 UTC
Jump to comment: Most recent file
Comments
Comment #1
gregglesThis may not be currently possible.
Comment #2
codeforkjeff commentedHere's a patch to tie the "user" token to recipient user, instead of logged-in user.
The code to load the recipient user was actually already in place, so this was a simple change.
It's a fairly localized change so shouldn't affect anything else, but I'd appreciate feedback.
Comment #3
jcw commentedConfirmed: patch #2 works (applied after patches #20 and #21 at http://drupal.org/node/952072).
Comment #4
gregglesIdeally both tokens should be available. There's a chance you'd want a message:
"Hi [recipient:name],
[comment:author] just commented on a thread to which you are subscribed."
So, I think we should provide a new set of user tokens for the recipient.
Comment #5
codeforkjeff commentedWhen would we ever use the [user] token? Info about the user who's leaving the new comment should always be looked up through the [comment] token (as in the example in #4), since that might contain a name, which you lose if you use the Anonymous user.
For clarity, I think recipient should replace user. I don't think it makes sense to have both.
Comment #6
gregglesThat does seem unlikely that people need the global $user token, but it seems like a major "drupalwtf" if "user contains tokens for the global user 99% of the time, but in comment_notify it contains tokens for the recipient."
Comment #7
dave reidI don't see why we'd need to provide another set of tokens? There's only two people involved, the person getting the notification, and the person who made the comment. The former is [user:*] and the latter is [comment:author:*]. The [user:*] token is never the global user and is always required to be provided with a user account object; the current user token is [current-user:*].
Comment #8
gregglesSo...I guess I forgot that in Drupal 7 the [user] token is separate from the [current-user] token?
Dave, are you saying you're +1 for the patch in #2?
Comment #9
codeforkjeff commentedOn second thought, I don't think there should be ANY user tokens at all. It's not always users involved, but comments.
There should be TWO comment tokens: the new comment that was just created, and the comment that asked for notification (called "recipientcomment" maybe).
This is because anonymous users can request notifications, and if the email template wants to properly address them, it needs to use something like "Hi [recipientcomment:author]", and not the anonymous user record.
Comment #10
pepino commentedsubscribing
Comment #11
dave reidWe have a [comment-subscribed:*] token type now.