I have a Triggered Rule where one action is to send a Private Message.
When the rule is triggered, it works with some users and not others.
I have created one user which always receives the Private Message, and a second one which does not.
The only error I have found is this, after I execute a Rule Set, which in turn triggers the Triggered Rule:
"Recipient type pet_registration is not correctly implemented"
Also, the user which does not receive the Private Message does receive email notification of the private message.
And, this is for more than one Rule Set.
Is there some setting required for a user to receive Private Messages? I can not find that setting.
Also, there is one Private Message actioned by a Triggered Rule when a node is created, and the user receives that, but it is not sent to the Inbox. It can be found in the All Messages box. The "Recipient Type" error appears there also.
Thank you.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 0001-by-Berdir-Enforce-type-user-in-role.patch | 1.28 KB | rfay |
| #12 | 0001-by-Berdir-Enforce-type-user-in-role.patch | 1.28 KB | berdir |
| #1 | enforce_type.patch | 884 bytes | berdir |
| Pvt Message Recipient Type.png | 2.15 KB | itserich |
Comments
Comment #1
berdirHm.
Privatemsg uses the type property to detect the type of recipient. By default, it's user but Privatemsg also allows to send messages to roles and other groups of users.
It seems that your user objects seem to have the type property set already, and to something that is not a valid recipient type.
Can you try the attached patch?
Can you send messages to those users manually?
Comment #2
itserich commentedI tried the patch by inserting the lines manually, so am not sure I did it correctly.
It appears only one new line is active: "+ $recipient->type = 'user';"
When inserted, the error message does not appear, but the message is also not received by the two users, including the user which previously received messages.
A message sent manually is received.
I do have a lot of modules, so there could be a conflict. If you would like admin access to the site let me know.
Thank you for the quick response.
Comment #3
berdirDid you add it with the + or without? It should be without...
Comment #4
itserich commentedThank you, yes, without the +, that is about the limit of my understanding of how to patch.
The user for which it works is older than the user for which it does not work, perhaps something has happened to not allow it to work newer users, but that is a pure guess.
There are a lot of modules, including Messaging & Notifications, and how mail works within Drupal has always been confusing to me, so could be a conflict.
Comment #5
berdirWell, do you have any idea where the string "pet_registration" is coming from?
You could for example search your sites/all/modules folder for that string.
Comment #6
itserich commentedPet Registration is a node type, it is a missing pet web site.
Comment #7
berdirNo idea.
Can you try to install devel.module and then add the following line of code directly above the one you added from the patch?
That should then print a debug thing with all information that is attached to that user. Is there a type property? Are there any differences between users to which you can send messages and those you can't?
Comment #8
itserich commentedWith the code changes to this:
I get this error message:
Parse error: syntax error, unexpected '<' in /home/petnotic/public_html/sites/all/modules/privatemsg/privatemsg_rules/privatemsg_rules.rules.inc on line 387
With line 387 being
Have not found a common point to the users, it is a small sample size so far.
However, the accounts I have found which work are older accounts, and when I create a new account it does not work.
Comment #9
berdiryeah, I only added the < ?php / ? > lines for highlighting, you only need to add the single line of actual code.
Comment #10
itserich commentedThis is the result of dpm($recipient);
" Called from /home/petnotic/public_html/sites/all/modules/privatemsg/privatemsg_rules/privatemsg_rules.rules.inc, line 387 "
I ran the rule on two nodes written by two users and one was received and the other not.
Also, the Sent Messages tabs shows the message was sent to both users.
I don't know what the differences could be with the users. Both have Default send method as Drupal mail and Enable Private Messages.
Neither has "Receive email notification for incoming private messages"
Comment #11
itserich commentedThis is from the one which worked:
And from the one which did not:
Comment #12
berdirYeah, so something *does* set the type, probably during the registration, I guess that's why old users work and new users don't.
Can you try the updated patch, that should really fix it...
Comment #13
itserich commentedThank you Berdir. It does work.
The Email Notification of Private Messages is a great way to make sure email is not missed.
Thank you so much for your quick and detailed help.
Comment #14
berdirLet's keep this open for now.
Will likely commit the patch. It's really a special case but fixing it doesn't cost us much and makes it a bit more error-prone.
Comment #15
rfay#12, but posted against 6.x-2.x instead of 6.x-1.x (It applies cleanly on 6.x-2.x)
Comment #16
rfayYay!
Comment #17
berdirD'oh!
Comment #18
berdirCommited.