ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Allow PHP on a per-user basis?

August 20, 2012 6:29pm

Subscribe [1]
  • #1 / Aug 20, 2012 6:29pm

    Mitch Cohen

    12 posts

    I’m prepping a site for launch which would greatly benefit by allowing PHP in templates for a narrow subset of users, but I don’t want to do so on a wide basis.  The field in question is the main body field for most site pages.  I’m looking for suggestions on how to make this, or something similar, happen.

    The best thought I have thus far is to add a text field called “include filename” and put it onto an extra tab.  In the template, attempt to include a file referenced in this field (if set).  That would at least require the same user to have FTP ability to the server, not just EE access.  Still seems like an ugly hack, so hoping for something better.

    Thanks,

      Mitch

  • #2 / Aug 22, 2012 9:26am

    Mitch Cohen

    12 posts

    I didn’t receive any responses, so I implemented this roughly as described above:

    -Add a text field called (roughly) “include”
    -Hide the field from all users in all channels using the entry page sidebar
    -Super-Admin can show the field, and enter the filename (not path) of file to include, e.g. “filetoinclude.php”
    -The included file must be uploaded by FTP to a specific directory on the server
    -The main template checks for contents of the “include” file.  If present, it sends it off to an embedded template.  That template has PHP enabled, and includes the file.

    Not exactly what I’d hoped for, but gets the job done.  If a regular user needs to include a file, they need to contact a super-admin who will do it on their behalf.

    Perhaps this will help someone else.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases