You are here

function og_role_watchdog_user in Role Watchdog 7

Same name and namespace in other branches
  1. 6.2 modules/og_role_watchdog/og_role_watchdog.module \og_role_watchdog_user()
  2. 6 modules/og_role_watchdog/og_role_watchdog.module \og_role_watchdog_user()
  3. 7.2 modules/og_role_watchdog/og_role_watchdog.module \og_role_watchdog_user()

Implementation of hook_user().

File

modules/og_role_watchdog/og_role_watchdog.module, line 78
Logs changes to user roles.

Code

function og_role_watchdog_user($type, &$edit, &$account, $category = NULL) {
  switch ($type) {
    case 'delete':

      // Note that it is very important that our hook_user be called before role_watchdog's
      // hook_user, because the later function will delete the information we are using in our
      // JOIN below.  We insure that this will be the case by setting our module weight to -1
      // in og_role_watchdog_install().
      db_query('DELETE orw FROM {og_role_watchdog} orw INNER JOIN {role_watchdog} rw ON orw.hid=rw.hid WHERE rw.aid=:uid', array(
        ':uid' => $account->uid,
      ));
      db_query('DELETE orw FROM {og_role_watchdog} orw INNER JOIN {role_watchdog} rw ON orw.hid=rw.hid WHERE rw.uid=:uid', array(
        ':uid' => $account->uid,
      ));
      break;
  }
}