You are here

function forum_access_update_6101 in Forum Access 6

Clean out {forum_access} table and remove Forum Moderator assignments.

File

./forum_access.install, line 194
Install, update and uninstall functions for the forum_access module.

Code

function forum_access_update_6101() {
  $ret = array();
  $forum_vid = variable_get('forum_nav_vocabulary', 0);
  $ret[] = update_sql("DELETE FROM {forum_access} WHERE tid NOT IN (SELECT tid FROM {term_data} WHERE vid = {$forum_vid})");
  $ret[] = update_sql("DELETE FROM {forum_access} WHERE rid NOT IN (SELECT rid FROM {role})");
  if ($moderator_rid = variable_get('forum_access_moderator_rid', FALSE)) {
    $ret[] = update_sql("DELETE FROM {users_roles} WHERE rid = {$moderator_rid}");
    $ret[] = update_sql("UPDATE {permission} SET perm = 'administer comments, administer nodes' WHERE rid = {$moderator_rid}");
  }
  return $ret;
}