Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We are using AJAX load in combination with editablefields module to allow quick editing of fields for our admins.
The AJAX load module adds the JS file (ajax_load.js) to the site regardless of usage. In our scenario AJAX Load is only ever required for logged in admins but anonymous users are also being served the ajax_load.js file which is unnecessary.
To reduce overhead on this site, I've modified the module to include the following check:
if (user_access('administer nodes')) {
drupal_add_js(drupal_get_path('module', 'ajax_load') .'/ajax_load.js');
}
It would be much better if we could either specify paths similar to the lightbox2 module or if AJAX Load had it's own user access permission.
Comments
Comment #1
karljohann CreditAttribution: karljohann commentedBrilliant. I also agree having its own permission is the way to go.