First, let it be known that I have scoured this site and Google for an answer to this.
I have userpoints installed and I also have a module that "erodes" userpoints to the tune of one per day. When one's userpoints get below a certain level, I would like to notify them. I have learned that I can create a Rule and make this happen for a logged in user. I guess it's called the "acting user". But what if they do not log in on that day? It doesn't work.
Is it possible to have a Rule that fires when cron runs that checks all the users and find the ones that have hit that threshold of points (say userpoints >=10 AND NOT >=11) and then sends them an email? Does Rules require the user to be logged in to take action? If that's the case, is there a workaround other people are using? Maybe they set a flag and notify them on the next login?
Thanks for any advice you might offer.
Comments
Comment #1
itangalo commentedIn this case, Views Bulk Operations is your friend.
A sketch for a solution:
1. Create a View that lists all users that should be notified
2. Turn it into a Views Bulk Operations, and add the action 'Send e-mail to user'
3. Create a rule set that calls the View you just created
4. Activate Rules Scheduler (included in the Rules project)
5. Add another action to your rule set -- one where you add a scheduled evalution of the set in +1 day
This means that once your rule set starts going, it will reschedule itself and be executed once every day. It will call the VBO, which then sends a notice to all affected users. Neat!
Three things that are worth taking notice of:
* Calling VBO from Rules can be a hazzle. Check out http://nodeone.se/blogg/johan-falk/make-rules-dance-with-views-bulk-oper... for some guidance
* Calling VBO and at the same time including configuration for an e-mail can be even more of a hazzle. An alternative is to create a rule set that sends e-mail to a user (given by an argument to the set). You'll then get a separate page (in the rule set) to configure the e-mail, which is easier than configuring it all in arguments to send to VBO.
* You'll need something to start this perpetuum mobile of scheduled rules. You could use a triggered rule or something else that can call rule sets.
Good luck!
//Johan Falk, NodeOne, Sweden
PS: I'm not maintaining the Rules module, just helping with support questions. You are welcome to ask more questions at http://groups.drupal.org/rules
Comment #2
mcfilms commentedThank you for this Johan. I will try this. I have one other question, because what I am asking is not complicated enough.
:)
Say I am able to get all that to work. Is it also possible to add one more Rule? I would like to check in with a Simplenews newsletter and see if that user is subscribed to it or not. If they are, then send this message, if not; don't. How would you approach this? Does the Simplenews subscription status expose itself to Rules? If not, can I write (or maybe find somebody smarter than me to write) a module to check this?
Thank you again.
Jerry Witt
Comment #3
benone commentedYeah I have the same question.
When Rules and Simplenews will be compatible ?