When using the RealName module, I ended up needing to create a token for the author of a comment. I ran into this when using the Notifications module.

When using Notifications, the ['realname'] token substitutes in the real name of the person receiving the message. However, I wanted to have the creator of the comment substituted in instead. To do this, I created a new token called ['realname-comment-author']. I'm attaching a patch with my changes. Please let me know if you have any questions.

CommentFileSizeAuthor
realname-comment-token.patch823 bytesJuliaKM

Comments

SamRose’s picture

Tested, it works!

Vasu’s picture

Title: Realname Comment Author Token » Author realname
Version: 6.x-1.x-dev » 6.x-1.3

Realname is working for users with permission. But when sending email updates about new content there is no token available to include author's real name. it looks odd where you can see the realname in the nodes but only author's usernames in the emails.

xjm’s picture

It would be nice to have a similar token for the author of a node, as well; something like [author-realname].

SamSound’s picture

I couldnt get it to work :S. is it in the latest release.
Can somebody upload me a working version?

Balbo’s picture

Not sure what is this about. It just provide a new token, isn't it?

Is it somehow related to the "Author by" field of a node (where I can't use the realname)?

nancydru’s picture

@JuliaKM: There really should be a matching hook_token_list value as well. Also, I don't see the value in a heavy user_load here; I changed it to $tokens['realname-comment-author'] = db_result(db_query("SELECT realname FROM {realname} WHERE uid = %d", $object->uid));

@xjm: You got it.

nancydru’s picture

Title: Author realname » Author realname tokens
Status: Needs review » Fixed

Committed to 6.x-1.x-dev.

Status: Fixed » Closed (fixed)

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