In the Token list at the help page there are several tokens listed related to bookings as they can be registered with the Rooms module (e.g. [rooms_booking:start-date] ). These tokens are however not available in Messages. Other Tokens are readily translated in that message but not these. Can I do something about this? Please give me hint, I have been trying to solve this for weeks now and mysite development is at a standstill.

Many thanks in advance.

CommentFileSizeAuthor
#5 Image2.jpg60.63 KBgreg2010
#5 Image1.jpg68.26 KBgreg2010
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Project: Token » Message
Version: 7.x-1.5 » 7.x-1.x-dev
Component: Miscellaneous » Code
Category: bug » support

Drupal core provides the basic token API. You'd need to ask the module that is actually doing the token replacement. I assume you meant that you're using the Message module, so transferring this issue over to that support queue.

TheoRichel’s picture

Thanks for the reply.

tigertrussell’s picture

This issue is plaguing me, right now. I'd say about 10-15% of the Tokens shown actually work, the others (many of which I need) do nothing. What is up with this?

PieterWintmolders’s picture

Issue summary: View changes

If you're using WYSIWYG-editor watch out with copy/paste. It puts in tokens. Switch to FullHTML to be sure the token is written correctly.

greg2010’s picture

FileSize
68.26 KB
60.63 KB

I am having the same issue.

The token title for a node translates fine but the token for the body does not. I tried creating several other text fields, one long text with summary and one just a normal text field, and neither token translated to content when sent.

See figure 1 for how the set up looks for the message template under structure->Message Types and image2 for the email I receive when the message is sent.

No Sssweat’s picture

oops see next post =P

No Sssweat’s picture


SOLUTION TO MISSING/NOT WORKING TOKENS

I had the same problem, I wanted to insert tokens regarding comments but they were not working when the message was created by the rules module. It only worked using the message example module, but I hated that the message example sends the message to the comment creator instead of the node author. Also if the message example module was not enabled, the comment tokens would not appear!

You won't need the message example module anymore, you can disable it =)

I found the solution to this:

STEP 1

- Create a message type. I named mine "Problem Solved"

- For message text: just put a temporary place holder. I typed "I will edit this later"

* see image -> http://s16.postimg.org/gp3apa243/Image1.jpg

STEP 2

- Go to the MANAGED FIELDS of the message type you just created.

- Add new field, I named mine "123456" for field type select "Entity Refence" and for widget select autocomplete and click save.

* see image -> http://s2.postimg.org/kix5oqbuv/Image2.jpg

- After saving, it will take you to another page, for Content Type: select comments from the drop down menu. Therefore, the tokens will be comments related. Click save, it will reload the page, click save again.
**NOTE if you have other modules installed, for example: the rooms module, you will see an option for that here. On my screenshot I don't have it installed, so it won't appear.

* see image -> http://s29.postimg.org/6b4cj5g91/Image3.jpg

STEP 3

- Go back to EDIT your message type. YOU WILL NOW NOTICE THAT UNDER Message tokens, you should now see a new category named 123456.

* see image -> http://s11.postimg.org/tnwnbvvgh/Image4.jpg

- For message text: You can now delete the temporary place holder and insert the tokens you want. In my case I am going to type: [message:field-123456:name] just said [message:field-123456:body] and save the message type.

* see image -> http://s14.postimg.org/tq347nyyn/Image5.jpg

STEP 4

- Go to rules and create a new rule. Name it whatever you wish. For event, we are going to select After saving a new comment

- You can add a condition if you wish, but I am not going to.

- For Actions, click the add action link. For select action to add, select create a new entity
- This will take you to another page, For value select message and click continue
- For type, select your message type. In my case it's called "Problem Solved"
- For data selectors, click on the bold blue data selectors link and it will show you all your options. I'm going to use comment:node:author Click save.

* see image -> http://s1.postimg.org/k0fdwg8rh/Image6.jpg

STEP 5

- Under Actions, click the add action link again, and this time we are going to select Set a data value
- For data selectors, put entity-created:field-123456 and click continue

* see image -> http://s1.postimg.org/5va1e0gnx/Image7.jpg

- Now on this page, There is a value field, for data selector we are going to put comment and click save

* see image -> http://s21.postimg.org/oyu53d4dh/Image8.jpg

Now this is what your rules should look like. http://s3.postimg.org/qvv6uf135/Image9.jpg

Now go make a comment and the tokens should work =)

No Sssweat’s picture

Status: Active » Closed (fixed)
Pierre.Vriens’s picture

If you are using Rules to create your messages to be delivered, you can make the missing tokens available by using the Replacement patterns for each message type. Refer to the answer to What's the purpose of "Replacement tokens" of a Message type? for way more details on that (these Replacement tokens are really a hidden gem about how Rules integrates with Message!).

JackG102’s picture

Comment #7 was amazing and helped me work through comment tokens not working. The secret was basically add an entity reference field to the comment entity on the message template. Afterwards, I used hook_comment_insert in my own custom module to set that field on the message to the comment created. Then, in the message template, I was able to select the newly created entity reference field token option from the explore token menu. Bravo!