You are here

function better_formats_check_roles in Better Formats 6

Ensure that all roles have Better Format entries in the database.

2 calls to better_formats_check_roles()
better_formats_defaults_admin_form in ./better_formats_defaults.admin.inc
Builds the form for the filters admin.
better_formats_enable in ./better_formats.install
Implementation of hook_enable().

File

./better_formats.module, line 272
Enhances Drupal's core input format settings.

Code

function better_formats_check_roles() {

  // Get all roles that do not have BF entries.
  $sql = "SELECT r.rid\n          FROM {role} r\n          LEFT JOIN {better_formats_defaults} bf\n            ON r.rid = bf.rid\n          WHERE bf.type_weight IS NULL";
  $result = db_query($sql);
  while ($role = db_fetch_object($result)) {

    // Add BF entries.
    better_formats_create_role($role->rid);
  }
}