I am trying to email a URI link to the message that exists in a specific use case, built from the message Id token or otherwise. I create or update the message in question and call save on the wrapper. When I call message_subscribe_send_message
it does not render the [message:mid]
token.
However id I call the message_notify_send_message($message)
function the [message:mid]
token is rendered in the email.
Any idea why this is happening? The other tokens I have tested seem to be fine. This issue looks similar to #2298325: Tokens of entity reference's OG not rendered in emails. Do I have to create a callback as described in that issue or is that a work around solution? Thanks for your help.
$wrapper->save();
message_notify_send_message($message); // Only added for demonstration/test
//Currently only the second time that the message is sent are the message entity tokens available.
if (module_exists('message_subscribe')) {
$mid = entity_id('message', $message);
if ($user->uid && $mid) {
_workbench_og_audience_moderation_message_subscribe_user($mid, array($user->uid));
}
if ($wrapper->field_message_moderate_status->value() == TRUE) {
// Add parameters in order to avoid creating message for every subscriber.
$notify_options = array(
'internal' => array(
'save on fail' => FALSE,
'save on success' => FALSE,
'mid' => $mid,
)
);
$subscribe_options = array(
'save message' => FALSE,
'author' => $user->uid,
);
// If Message-subscribe exists, let this example module use it.
$subscribe_options['uids'] = message_subscribe_get_subscribers('message', $message, $message);
message_subscribe_send_message('message', $message, $message, $notify_options, $subscribe_options);
}
}
Comments
Comment #1
bluegeek9 CreditAttribution: bluegeek9 as a volunteer commented