Update a user field every time the user is edited/created

Public

In this example we are using a "last_updated" field that we have added to the user. Every time the user is updated or created the field is filled and saved with the unix time.

</> CopyGet raw version
php
  1. function MYMODULENAME_user_presave(&$edit, $account, $category) {
  2. $edit['last_updated']['und'][0]['value'] = date('U');
  3. }