How can I schedule adding a new field collection item for all users? My users have a field collection, called 'Score', with two fields: 'Date' and 'Points'. I'd like to add a new field collection item for all users at the end of the day, with the current date in 'Date' and their current userpoints in 'Points'.

I thought about using a scheduled rule, but I don't know how I can select something like 'all users'. Is this possible with Rules or is there another way to achieve this?



This question is part of How to create a line graph of the total user points on a profile page?.
I'm not sure about rules but you could do that in a custom module with a little code:

$uids = db_query("SELECT uid FROM {users} WHERE status=1")-&gt;fetchCol();
$accounts = user_load_multiple($uids);
foreach($accounts as $account) {
    $edit['my_field'][LANGUAGE_NONE]['0']['value'] = 'my new value';
    user_save($account, $edit);
}