D7: Resetting ALL user fields (Boolean) at once In a nutshell, I'm trying to stop my users from getting e-mailed more than once per day.


I have some rules set up that will e-mail users when content particular to them is updated.  
I have added a Boolean field to user profiles that starts off 'checked' (1) - indicating they have not (yet) been emailed today.


Any rules that e-mail users will first check this user profile value and proceed only if they haven't been e-mailed (field value is 1), but then set this Boolean value to 0 using set a data value in Actions - thus they won't get e-mailed again until the value is changed.

What's the best/easiest way to 'reset' that field in ALL user profiles periodically? (probably once a day)  

i.e. at 10:00PM set the boolean field "field_user_not_emailed_today" for ALL users to 1. (checked)

I've seen VBO recommendations for this sort of thing, but seems unnecesary given the ALL users thing.  Is there perhaps a PHP snippet I could call in Rules that would do the trick?

Thanks!
The Rules Once per Day module provides a 'Once per day' rules event that you can use to trigger your boolean flag update.

For bulk updating a list of users, if you have an action that loads a list of users you can then loop through and act on those users with rules.

There are a number of ways you can load a list of users in rules. Some of them are:


The Views Bulk Operations module provides some actions including 'Load a list of entity objects from a VBO view'
The Views Rules module provides the 'Collect view result rows' action.
The Rules Bonus Pack module provides a number of actions, including 'Load a user list with Views'.
You can create a custom action of your own via a custom module. See the rules developer documentation and various blog posts for more details. 


I'm not sure of any easier way to loop through all users in the system, but the views approach is fairly straight forward and low maintenance anyway.

Also, you might not always want to loop through all users. for example you might want to exclude administrators or only loop through users where your boolean field is set to 1, to avoid unnecessary processing in the case that not all users have been set to 1 for whatever reason.

The action you use to load the users will create a new variable (eg. 'entity-list') that will be available in future actions. You can then use the 'Add loop' option in the rules actions section to loop through that new variable. That loop will create another new variable for the current item (eg. 'list-item') your are looping over and then you can add actions that act on that variable (eg. data set on list-item:field-user-not-emailed-today).