function disable_messages_install in Disable Messages 6
Same name and namespace in other branches
- 8 disable_messages.install \disable_messages_install()
- 7 disable_messages.install \disable_messages_install()
- 2.x disable_messages.install \disable_messages_install()
Implementation of hook_install().
File
- ./
disable_messages.install, line 11
Code
function disable_messages_install() {
variable_set('disable_messages_enable', '1');
variable_set('disable_messages_ignore_patterns', '');
variable_set('disable_messages_ignore_regex', array());
variable_set('disable_messages_ignore_case', '1');
variable_set('disable_messages_filter_by_page', 0);
variable_set('disable_messages_page_filter_paths', '');
variable_set('disable_messages_exclude_users', '');
variable_set('disable_messages_enable_debug', '0');
variable_set('disable_messages_debug_visible_div', '0');
// Add the access message permission to all roles.
$result = db_query('SELECT * FROM {role}');
while ($role = db_fetch_object($result)) {
$perm = db_result(db_query('SELECT p.perm FROM {permission} p WHERE p.rid = %d', $role->rid));
if ($perm) {
db_query('DELETE FROM {permission} WHERE rid = %d', $role->rid);
$perm .= ', ';
}
// Add view all message permission for all users.
$perm .= 'view status messages, view warning messages, view error messages';
db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role->rid, $perm);
}
drupal_set_message(t('Added view all message types permissions for all roles. You can change this in !link', array(
'!link' => l('administer permissions', 'admin/user/permissions', array(
'fragment' => 'module-disable_messages',
)),
)));
}