I've searched far and wide, here and via Google, and can find no mention of this issue. I'm stumped.

I've run Drupal 7 multi-site installations on two other servers prior to the current one I just started an account on. On those other installations I've had no trouble using the Add to Head module. On this one, when I try to save a rule, I get this error:

403 Permission Denied
You do not have permission for this request /admin/config/development/add-to-head/add

Yes, the admin account I'm using has the permission block checked.

I've tried uninstalling and reinstalling the module, and even created a second site to test whether the behavior was the same. It is. I logged into the account via ssh and checked the ownership of the Drupal site and everything belongs to my account (I even did a recursive chown just to be sure) and the Drupal installation is new so there should only be the default permissions throughout. I don't understand why it works elsewhere but not here.

This is really frustrating, and I'm out of ideas to check. Any ideas out there?

Many thanks in advance,

Comments

John_B’s picture

It is puzzling. You may need to do some heavy debugging, or hard code the code you want to add. Before doing that, it is worth checking the obvious. Check whether you have access to admin/config/development/add-to-head which uses the the same 'administer add to head' permission as /admin/config/development/add-to-head/add. Compare a site where it works and confirm the version of Drupal core is the same, and that the version of php on the server is the same.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

Spinland’s picture

The server where it's working is PHP 5.4.39, the new one is 5.4.40. I'm not sure that's a problem.

What I have learned is that on the new server I can actually add PHP code and META tags, but anything in script /script tags gets rejected regardless of whether I'm just adding trivial JS code or trying to link in an external JS file.

John_B’s picture

That may be because your site does not have the filter set up correctly, as pointed out here: https://www.drupal.org/node/556648#comment-3869348 (so the tags are getting escaped).

Anyway, adding JS and PHP into pages (and hence into the database) makes for a site which is pretty horrible to maintain. It is worth the extra effort of doing it right (i.e. putting PHP and JS into the site's code rather putting them in the site's database).

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

Spinland’s picture

Well, wasn't the filters that I could see but something was definitely stripping "script" tags even when I tried to echo them via PHP.

It's not that big a deal in the big picture, it was just convenient for adding stuff ad hoc to specific pages to see how it would work. I've moved on, and thanks for the input.