Updating all existing user's custom field I am fairly new to Drupal development and ran into a problem when trying to create a cron to update the value on a custom field for all the existing users.

Here is the code, when I click run cron it does nothing. I do no see my value in the custom field I created on any of the users.

/**
* Implementation of hook_cron().
*/
function testingdev_cron() 
{
  $users = entity_load('user');
  foreach ($users as $user)
  {
    $user-&gt;field_my_field = 'test';
    user_save($user);
  }
}
Found out why it was not working (Which also explains why none of my debugging was displaying.) I had to skip over the the user with UID of 0 and modify how I set the field value or else the user_save function would break the code (For anyone that is interested.)

/**
* Implementation of hook_cron().
*/
function testingdev_cron() 
{
  $users = entity_load('user');
  foreach ($users as $user)
  {
    if($user-&gt;uid == 0)
    {
      continue;
    }

    $edit = array(
      'field_my_field' =&gt; array(
        'und' =&gt; array(
          0 =&gt; array(
            'value' =&gt; 'test'
            )
          )
        )
      );
    user_save($user, $edit);
  }
}