You are here

function forum_access_update_6102 in Forum Access 6

Set the proper permissions for the Forum Moderator role.

File

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

Code

function forum_access_update_6102() {
  $ret = array();
  if (!module_exists('forum_access')) {
    return abort_disabled_update();
  }
  $moderator_rid = forum_access_query_moderator_rid();
  if (isset($moderator_rid)) {
    if (db_result(db_query("SELECT COUNT(*) FROM {permission} WHERE rid = %d", $moderator_rid))) {
      $ret[] = update_sql("UPDATE {permission} SET perm = 'administer comments, administer nodes' WHERE rid = {$moderator_rid}");
    }
    else {
      $ret[] = update_sql("INSERT INTO {permission} (rid, perm) VALUES ({$moderator_rid}, 'administer comments, administer nodes')");
    }
  }
  return $ret;
}