When the token module is active and the email notification in private messages is enabled and the workflow module is enabled I get above error.
Deactivating the token module or the notification module solves the problem. However I need them both
My error with backtrace gave:
EntityMetadataWrapperException: Unknown data property recipient.(/sites/all/modules/contrib/workflow/workflow.entity.inc on line 311) in EntityStructureWrapper->getPropertyInfo() (line 345 of //sites/all/modules/contrib/entity/includes/entity.wrapper.inc).
So looking in the workflow module I found it is trying to replace the tokens in the workflow.tokens.inc. Therefore I made a little patch which seems to work and has no problems with other modules. It works for me.
diff --git a/sites/all/modules/contrib/workflow/workflow.tokens.inc b/sites/all/modules/contrib/workflow/workflow.tokens.inc
index 085cfa0..549dc75 100644
--- a/sites/all/modules/contrib/workflow/workflow.tokens.inc
+++ b/sites/all/modules/contrib/workflow/workflow.tokens.inc
@@ -154,7 +154,7 @@ function workflow_tokens($type, $tokens, array $data = array(), array $options =
// The 'node' tokens have already been replaced with 'entity'.
// Skip for easier debugging.
// @todo: is this always the case, or only if Entity Tokens is enabled?
- if ($type == 'node' || $type == 'user' || $type == 'term') {
+ if ($type == 'node' || $type == 'user' || $type == 'term' || $data['entity_type'] =='privatemsg_message') {
return $replacements;
}
Have never created a patch here so do it this way for review since got some deadlines to make.
Hopefully this helps to determine what exactly is wrong.
Comment | File | Size | Author |
---|---|---|---|
#11 | workflow_tokens.patch | 1.7 KB | kyoder |
#6 | workflow-temporarily_disable_tokens-2413593-6.patch | 812 bytes | GuyPaddock |
Comments
Comment #1
wouser CreditAttribution: wouser commentedThe patch provided works but throws the error below 10 times in a row on every page.
**Private Messages will not allow sending individual messages to users with the above error, here is more documentation via PM: https://www.drupal.org/node/2399367
Does anyone else have any suggestions for fixing this issue, I wish I had the knowledge to help.
Error:
"Notice: Undefined index: entity_type in workflow_tokens() (line 157 of /usr/home/justme53/public_html/""/sites/all/modules/workflow/workflow.tokens.inc)."
Comment #2
erald CreditAttribution: erald commentedActually had the same problem and changed the patch
so on top of above patch I patched..
basically reverting the earlier patch and adding a few lines to avoid the mentioned error.
Just forgot to publish this here..
Comment #3
wouser CreditAttribution: wouser commentedThank you Erald for posting this.
I've tested this patch and it works, I am still able to send messages and no annoying errors.
Not sure if this is related but I received an error after implementing this patch: Strict warning: Declaration of hs_taxonomy_views drupal. There is an issue related to this: http://r.search.yahoo.com/_ylt=A0LEVv7rOhhVgVoAy8cnnIlQ;_ylu=X3oDMTEzMW0...
However, I've never seen this error previously.
Comment #4
wouser CreditAttribution: wouser commentedComment #5
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for House at Work commentedWorkflow shouldn't be coupled to Private Message like this. The logic should be robust enough to deal with other entity types without having to explicitly whitelist them here.
Comment #6
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for House at Work commentedLooking at related issues and the implementation
workflow_tokens()
, this is a mess. This code is hard to follow and makes a lot of assumptions that don't hold true (like assuming it should handle tokens for things it doesn't control).I'm in a crunch at the moment preparing a project for a client that uses both Privatemsg Notifications and Workflow, and so I don't have the time at the moment to rewrite this function, but I'm running with the attached patch to disable Workflow tokens entirely in the interim since my project doesn't need them.
This is not a viable long term solution -- people need tokens -- but I'm posting this here until I can write a proper patch to address token support shortcomings.
Comment #7
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for House at Work commentedAssigning to me.
Comment #8
kyoder CreditAttribution: kyoder commentedAny updates on this?
Comment #9
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for House at Work commentedNo; unfortunately, I have not been able to make sense of the existing code. It's spaghetti code.
Unassigning from me, for the moment, in case anyone else wants to take it. If I can fix it, I'll provide a patch here.
Comment #10
erald CreditAttribution: erald commentedWe abandoned the workflow module completely so my problem on this is solved for now. But is not a long term solution either.
Comment #11
kyoder CreditAttribution: kyoder commentedhere's a patch that fixed this issue for me, without disabling workflow tokens
Comment #12
Leeteq CreditAttribution: Leeteq commented@erald; in case you abandoned workflow module for some other solution/module(s)/workaround, do you care to share which one(s), as that may be interesting for other projects in their evaluation stage?
Comment #13
erald CreditAttribution: erald commented@Leeteq: Because I encountered this problem including problems I had with creating views for the workflow.( We had the workflow connected to users not nodes) We decided to create our own workflow module where we use nodes referenced to the user. That in combination with a custom module (hook to alter forms) to change the role of the user we were able to create any view we needed without problems. In combination with rules and some custom rule actions we are sending private messages and creating some workflow messages on changes of the user role. Now I can even send bulk mails and have a message in the workflow of the message.
The scripts I had to create were actually quite simple and we have a good working solution which overcomes the limitations and problems with the workflow module which is not really suited to use for users.
Comment #15
johnv#11 is committed. Thanks.