- Default message types
- Business logic to create new messages for sending
- Default views for the message subscribe UI
- Alter the message subscribe UI menu link name
- Link to the notification settings form from the search box

Comments

erikwebb’s picture

Title: Implement email notifications & UI with message_subscribe_email » Implement email notifications & UI with Message Subscribe
ezra-g’s picture

A first round of the UI is now in place: http://drupalcode.org/project/commons_follow.git/commit/dca7174

Next: revisions to the UI and actually creating and sending emails.

ezra-g’s picture

Progress on this continues in the message-subscribe-refactor branch of commons_notify.

However, I'm running into some issues with token replacement on some of the entity reference fields.
Specifically, these tokens are replaced successfully:

[message:field-target-nodes:0:content-type]

However, I'm not able to get the referenced node body to be replaced successfully. For good measure, I've tried some variations:

[message:field-target-nodes:0:body:value]
[message:field-target-nodes:0:body]
[message:field-target-nodes:0:body:?]
[message:field-target-nodes:0:body:summary]

[message:field-target-nodes:1:body:value]
[message:field-target-nodes:1:body]
[message:field-target-nodes:1:body:?]
[message:field-target-nodes:1:body:summary]

[message:field-target_nodes:0:body:value]
[message:field-target_nodes:0:body]
[message:field-target_nodes:0:body:?]
[message:field-target_nodes:0:body:summary]

[message:field-target_nodes:1:body:value]
[message:field-target_nodes:1:body]
[message:field-target_nodes:1:body:?]
[message:field-target_nodes:1:body:summary]

There are several potentially relevant issues related to Entity API and Token:

#1487990: Token not working for Entity reference field (multiple values) - Has at least 1 duplicate.
#1272560: Entity tokens duplicates field tokens created by token module
#691078: Field tokens

At this point, it would be great to get some input from folks who are more familiar with the current state of Entity/Token integration.

Dave Reid’s picture

Maybe it would help me to see what is the output result you are looking for in terms of tokens? I need to see the larger context of the desired string.

ezra-g’s picture

ezra-g’s picture

And, I'm currently working with this text for the message body:

[message:field-target-nodes:0:body:value]
[message:field-target-nodes:body:value]
[message:field-target-nodes:title]
[message:field-target-nodes:0:body:summary]
[message:field-target-nodes:0:text]

Hi [firstname or username],

[message:field-target-nodes:0:author] created the [message:field-target-nodes:0:content-type] “[message:field-target-nodes:0:title]” on [site:name] [commons-groups:in-groups-text] on [message:field-target-nodes:0:created]:

[message:field-target-nodes:0:url]

[message:field-target-nodes:0:body:value]
[message:field-target-nodes:0:body]
[message:field-target-nodes:0:body:text]
[message:field-target-nodes:0:body:?]
[message:field-target-nodes:0:body:summary]

[message:field-target-nodes:1:body:value]
[message:field-target-nodes:1:body]
[message:field-target-nodes:1:body:?]
[message:field-target-nodes:1:body:summary]

[message:field-target_nodes:0:body:value]
[message:field-target_nodes:0:body]
[message:field-target_nodes:0:body:?]
[message:field-target_nodes:0:body:summary]

[message:field-target_nodes:1:body:value]
[message:field-target_nodes:1:body]
[message:field-target_nodes:1:body:?]
[message:field-target_nodes:1:body:summary]

Add a comment at [message:field-target-nodes:0:url]#comment-form

Change email notifications at [site:url]/settings

fago’s picture

Is it a multiple entity-reference field? So does any of the referenced node tokens work or none?

ezra-g’s picture

@fago and @Dave Reid - Thanks for weighing in here!

It is a multiple value entity reference field. The behavior I was seeing was that the title and node type appeared to be replaced successfully, but not the body.

The message was being sent for token replacement in a hook_node_insert() implementation --
I added a

entity_get_controller('node')->resetCache(array($node->nid));

and now the title is successfully replaced.

You can see this in context at http://drupalcode.org/project/commons_notify.git/blob/refs/heads/7.x-3.x... .

ezra-g’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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