Error editing custom theme

I made the upgrade to 1.4.9 and the photo gallery works fine.

But now when I try to edit my own custom theme I get the error:
--------------
Cannot edit this file!
Fatal error: Cannot edit this file! in ../zp-core/functions-common.php on line 294
--------------

The custom theme is based on zp-base master. I can edit it only via ftp. It is not a problem, but I would like to fix the issue.
Before upgrading I did not get that error.
Any idea?

Thank you for replying.

Comments

  • acrylian Administrator, Developer
    With edit you mean the simple built in theme file editor? That should not have acccess to core files like functions-common.php and these files should never be modified anyway.

    Please review your error logs. Perhaps you have some file/folder permission issues.
  • Yes, the "edit" button under zp-core/admin-themes.php.

    I remember I could edit my own theme from that page.
  • Here the error in my log:
    -------------
    USER ERROR: Cannot edit this file! in .../zp-core/functions-common.php on line 294
    trigger_error called from zp_error (functions-common.php [294])
    from admin-themes-editor.php [35]
    -------------
  • acrylian Administrator, Developer
    I cannot reproduce the issue so far (I admit I never use this editor). I assume that you have a file/folder permission issue so you cannot edit the files (The error is of course not about the core file at all, my bad).

    Check your server log as that might tell more than the Zenphoto one. See the user guide about the right permissions.
  • I was having the same problem, and I found a solution through some debugging of the php files in zp-core

    For me, it turned out that the php realpath() function was messing up the path to the theme directory by lopping off the top level of the path (perhaps due to something about how files are actually stored and organized by my hosting site, which is 1&1.)

    I removed the call to realpath() as a blunt force fix that worked in my case. This is on line 10 of admin-themes-editor.php

    Depending on file structure on a particular server, I suppose this could cause other issues, but it is working for me.
  • acrylian Administrator, Developer
    Thanks for the note. The theme editor is not really the best choice to edit a theme as it is really basic IMHO.

    Better is to use this via FTP and a proper code editor. BEst is even to do all changes first on a local copy of your site instead of working on the live site.
Sign In or Register to comment.