Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | Image2.jpg | 60.63 KB | greg2010 |
#5 | Image1.jpg | 68.26 KB | greg2010 |
Comments
Comment #1
Dave ReidDrupal 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.
Comment #2
TheoRichel CreditAttribution: TheoRichel commentedThanks for the reply.
Comment #3
tigertrussell CreditAttribution: tigertrussell commentedThis 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?
Comment #4
PieterWintmolders CreditAttribution: PieterWintmolders commentedIf 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.
Comment #5
greg2010 CreditAttribution: greg2010 commentedI 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.
Comment #6
No Sssweat CreditAttribution: No Sssweat commentedoops see next post =P
Comment #7
No Sssweat CreditAttribution: No Sssweat commentedSOLUTION 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 =)
Comment #8
No Sssweat CreditAttribution: No Sssweat commentedComment #9
Pierre.Vriens CreditAttribution: Pierre.Vriens commentedIf 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!).
Comment #10
JackG102 CreditAttribution: JackG102 as a volunteer commentedComment #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!