Closed (fixed)
Project:
Privatemsg
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2010 at 02:03 UTC
Updated:
4 Feb 2010 at 04:00 UTC
Jump to comment: Most recent file
Hello,
Is it currently possible to send a Welcome Message to all new users?
Is this done by the new Rules integration? I attempted with Rules but failed to have the message sent.
I hope to get some advice on achieving this.
Regards
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | clean drupal install.png | 49.29 KB | robby.smith |
| #11 | rule with privatemsg.png | 53.11 KB | robby.smith |
| #11 | rule from scratch.png | 48.62 KB | robby.smith |
| #11 | rule from scratch2.png | 46.09 KB | robby.smith |
| #11 | output with rule from scratch.png | 44.75 KB | robby.smith |
Comments
Comment #1
robby.smith commentedThis is the rules output:
•0 ms "User account has been created" has been invoked.
•0.077 ms Executing the rule "Welcome Message" on rule set "User account has been created"
•0.192 ms Action execution: "Load a user account"
•6.383 ms Successfully added the new variable "load user"
•6.535 ms Action execution: "Send a message"
•6.669 ms Writing new message with subject welcome to trupal218 from admin
•8.725 ms Message not sent, reported error: Disallowed to send message because all recipients are blocked
Also, I use the LoginToboggan module so that users must validate their new user account via their personal email.
LoginToboggan module sets the user as non-authenticated role until they validate, then they are given the authenticated role.
I hope someone can shed light on solving this issue.
Regards
Comment #2
robby.smith commentedBelow is the Rule trigger (http://drupal.org/node/327938#comment-2349964)
Comment #3
robby.smith commentedWith further investigating, I think this may have to do with the setting "Restrict Private Messaging to only related users" which I have set to "Allow sending messages only to confirmed relationships". I have this so that all users on my site cannot message each other unless they have a confirmed relationship, but my guess on what is happening is this setting also applies to Admin which is not allowing me to send this Welcome Message from the admin.
I opened this issue at http://drupal.org/node/678806 but keeping this issue open as I may be completely off on the reason for my issue.
Thank you
Comment #4
berdirThat might be one issue (see what I wrote there), another one could be, that that your non-authenticated role might not be allowed to recieve messages. You could try to check if rules gives you an event when a user recieves a role, so you could send the message once he activates his account. Or, give those users recieve permission if they didn't have already.
I see that in such cases, it would be helpful to display warnings too, since the reason, why you are not allowed to send a message is a warning. But you can easily verify that by sending a message manually.
Comment #5
berdirSince you know how to do it, let's change the issue to reflect what's the actual issue, atleast regarding Privatemsg itself.
Comment #6
berdirPlease try the patch, that should display why the recipients are blocked.
Comment #8
berdirStrange, uid 1 does have all permissions.
Maybe you switched the author/recipient (aka, rules tries to send a message from your new user to the admin), try posting the configuration of the send message action.
Comment #9
robby.smith commentedyea sorry, the 'rules setup2.png' above was suppose to be it but I made a mistake.
Please see the attached screengrab. The setup looks to be fine right? Hmm
Edit by Dave Reid: Added links to previously attached screenshots
http://drupal.org/files/issues/rules%20warning%20output.png
http://drupal.org/files/issues/permissions%20screenshot.png
http://drupal.org/files/issues/rules%20setup1.png
http://drupal.org/files/issues/user%20has%20roles.png
http://drupal.org/files/issues/user%20relationship%20privatemsg%20featur...
Comment #10
berdirYes, your configuration looks ok, but the debug message looks strange.
"Writing new message with subject Welcome! to xxx from ".
At the end, it should display $author->name but that seems empty, so I suppose it couldn't load the user object. I have no idea why, what I would suggest is to delete the whole rule and create a new one with the same configuration. You can also try to add the following line at the start of the privatemsg_rules_new() function but that will break redirection after registration so only use that for debugging on a test site:
Comment #11
robby.smith commentedHi Berdir,
(Good News! but starting with bad news..)
I create a clean install of drupal 6.15 with only the below two modules installed.
Privatemsg 6.x-2.x-dev 2010-Jan-07
Rules 6.x-1.x-dev 2009-Dec-11
I got the same error result with "Writing new message with subject Welcome! to xxx from ".
Screenshot attached.
I added line to privatemsg_rules.rules.inc as instructed.
Output:
array(4) { ["subject"]=> string(8) "Welcome!" ["body"]=> string(26) "Hey , welcome on our site!" ["#argument map"]=> array(2) { ["recipient"]=> string(7) "account" ["author"]=> string(10) "admin_user" } ["#eval input"]=> array(1) { ["rules_input_evaluator_php"]=> array(1) { ["body"]=> array(1) { [0]=> string(7) "account" } } } }
It looks like the "author" is just showing the machine readable variable name "admin_user".
Screenshot attached.
Now the Good News!
As you suggested I deleted the rule that comes with privatemsg and create the rule from scratch.
It looks the exact same as the rule that comes with privatemsg but it works! I wonder why..
Please let me know if I can do any additional testing to help fix the rule that comes with privatemsg.
Comment #12
berdirGood. Maybe there was a conflict as you may have created your rule with an older version of privatemsg_rules. Not sure, though, $author is something completely strange, looks like internal rules stuff.
Comment #13
robby.smith commentedAlso, I still have an issue with "Allow sending messages only to confirmed relationships" feature of User Relationship module not allowing admin to send out emails.
Would you be able to assist for this in anyway?
http://drupal.org/node/678806#comment-2456948
This feature is really cool making users only able to send message to one another if they are friends.
But I think there should be a way to give exceptions for users such as admin.
Thank you
Comment #14
berdirThe above patch has been commited, warning messages are now displayed in the rules debug output when sending messages.
Comment #15
robby.smith commentedawesome, thanks!