function filter_update_7008

Grant usage of all text formats to user roles having the 'administer filters' permission.

Related topics

File

modules/filter/filter.install, line 447

Code

function filter_update_7008() {
    // Build the list of permissions to grant.
    $permissions = array();
    foreach (db_query('SELECT format FROM {filter_format}')->fetchCol() as $format_id) {
        if ($format_id != variable_get('filter_fallback_format')) {
            $permissions[] = 'use text format ' . $format_id;
        }
    }
    // Grant text format permissions to all roles that can 'administer filters'.
    // Albeit anonymous users *should not* have the permission, we cannot presume
    // that they do not or must not.
    if ($roles = user_roles(FALSE, 'administer filters')) {
        foreach ($roles as $rid => $name) {
            _update_7000_user_role_grant_permissions($rid, $permissions, 'filter');
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.