Allow a non-site administrator access to clear-cache through administrator menu, Drupal 6

5.8k views Asked by At

I have a site-editor user role with custom permissions. Currently they can access some actions in the admin menu, but they cannot access clear-cache.

I want to expose just that option to the non-administrator (site-editor) user role. I can't find an option that granular in the permissions.

I've found some alternative options, but they involve coding, custom pages, etc. I want a pure drupal GUI option (if any exists). Not: http://drupal.org/node/152983

The reason is that site-editors enter content, but I'm caching panels and views. I need them to be able to clear the cache so they can see the changes they've made.

5

There are 5 answers

1
googletorp On

It wouldn't take many minutes to create a custom form with a clear-cache button that you can give your editors access to.

The function you need to call to clear the cache is drupal_flush_all_caches

I'm not sure how this option differ from a pure drupal GUI. They are built the same way after all.

Alternatively, you could write a bit of custom code, to clear your panels/views cache when content is created or edited, which would remove this need.

0
Matt V. On

If you really don't want to create a custom module, there is handbook page on creating a page to clear your cache that includes a snippet to add to a page using the PHP Input format and a refinement in the comments. Keep in mind, using the PHP Input Format is usually discouraged.

0
dilari On

use the flush page cache module? http://drupal.org/project/flush_page_cache

You can specify what to flush and permit specific roles

0
Balint Csaba On

Check the new CacheFlush module for clearing cache with different roles also you can create presets for clearing the cache just you need helping to save time on development process.

0
teampoop On

If you are using admin_menu, the flush cache ability is given to the 'administer site configuration' permission, which is way bigger than needed. I am thinking of creating a small module that simply does the following:

<?php
function flusher_menu_alter($items) {
  $items['admin_menu/flush-cache']['access arguments'] = array('flush cache');
}
function flusher_permission() {
  return array(
    'flush cache' => array(
      'title' => t('Flush the cachce'),
      'description' => t('This allows non admins to flush the cache'),
    );
  );
}

How's that sound?