You are here

function mass_contact_update_6000 in Mass Contact 6

Implementation of hook_update().

Updates permission names.

File

./mass_contact.install, line 89
This is the un/install file for the Mass Contact module.

Code

function mass_contact_update_6000() {
  $ret = array();
  $result = db_query('SELECT * FROM {permission}');
  while ($permission = db_fetch_object($result)) {
    if (strstr($permission->perm, 'access mass contact form')) {
      $new_permission = str_replace('access mass contact form', 'send mass contact e-mails', $permission->perm);
      $ret[] = update_sql('UPDATE {permission} SET perm = "' . $new_permission . '" WHERE rid = ' . $permission->rid . ' AND tid = ' . $permission->tid);
    }
  }
  return $ret;
}