Juergen Posted April 4, 2015 Share Posted April 4, 2015 After upgrade I got the following error: Compile Error: Cannot redeclare PageEditFieldPermissionConfig() (previously declared in /home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php:8) (line 69 of /home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php) This error message was shown because you are logged in as a Superuser. Error has been logged. I upgraded wire and index.php not the htaccess file. At the moment I changed it back to 2.5.24 to get it working. Does anyone struggle with the same problem? Link to comment Share on other sites More sharing options...
Peter Knight Posted April 4, 2015 Share Posted April 4, 2015 Does the same thing happen if you use the Upgrade module? Link to comment Share on other sites More sharing options...
Juergen Posted April 4, 2015 Author Share Posted April 4, 2015 I use the upgrade module - it was not updated via FTP. It seems that PageEditFieldPermission Module doesnt work with the latest version. Link to comment Share on other sites More sharing options...
horst Posted April 4, 2015 Share Posted April 4, 2015 (edited) The Question is why do you have two classes with the same name: "PageEditFieldPermissionConfig"? One in the sites module directory and now there seems to be one in the core too? Can you have a look to this? Ah, I have edited your error and wrapped it into different lines, Now we can read it better: It isn't about two classes, it seems to have two methods with the same name: Compile Error: Cannot redeclare PageEditFieldPermissionConfig() (previously declared in /home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php:8) (line 69 of /home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php) Please have a look into site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php at line 8 and at line 69, it seems that those lines both want to declare a method (or class) with the same name: PageEditFieldPermissionConfig. Edited April 4, 2015 by horst Link to comment Share on other sites More sharing options...
Juergen Posted April 4, 2015 Author Share Posted April 4, 2015 Hello Horst, I have looked into that before I have posted this topic, but I couldnt find the reason on line 8 and 69. <?php /** * Provides the implementation for the PageEditFieldPermission::getModuleConfigInputfields method * */ function PageEditFieldPermissionConfig(array $data) { $inputfields = new InputfieldWrapper(); $f = wire('modules')->get('InputfieldMarkup'); $f->label = 'How to use this module'; $f->attr('name', '_instructions'); $config = wire('config'); $f->value = <<< _OUT <p> To use, create a <a href='{$config->urls->admin}access/permissions/'>new permission</a> and name it <b>page-edit-[field]</b>, replacing [field] with the name of the field you want to limit access to. <em>Better yet, use the tool below to create them for you and save some time.</em> </p> <p> Once your page-edit-[field] permission(s) exist, <a href='{$config->urls->admin}access/roles/'>add them to any roles</a> that you want to have edit access to the field. Roles that have edit access to a page, but do not have the required page-edit-[field] permission will not be able to see or modify the [field] in the page editor. </p> <p>Note that none of this applies to users with the superuser role, as they always have access to edit everything.</p> _OUT; $createPermissions = wire('input')->post->_create_permissions; if($createPermissions) foreach($createPermissions as $name) { $name = wire('sanitizer')->pageName($name); $permission = wire('permissions')->add("page-edit-$name"); $permission->title = "Access to edit the '$name' field"; $permission->save(); wire('modules')->message("Added permission: $permission->name"); } $inputfields->add($f); $f = wire('modules')->get('InputfieldCheckboxes'); $f->attr('name', '_create_permissions'); $f->label = 'Handy tool to create permissions for you'; $f->optionColumns = 3; $f->description = 'Check the box next to each field name you would like this tool to create a permission for you. This is the same thing as going to the Permissions page and creating them yourself, so this is here primarily as a time saver.'; $fields = array('name', 'parent', 'template', 'status'); $notes = ''; foreach(wire('fields') as $field) $fields[] = $field->name; foreach($fields as $name) { if($name == 'pass') continue; if(wire('permissions')->get("page-edit-$name")->id) { $notes .= "$name, "; continue; } $f->addOption($name); } if(!$notes) $notes = "[none yet]"; $f->notes = "Fields that already have permissions: " . rtrim($notes, ", ") . ". " . "Non-superuser roles that have page-edit access will no longer be able to see/edit these fields unless the appropriate permission is assigned to that role. "; $inputfields->add($f); return $inputfields; } Line 8 is function PageEditFieldPermissionConfig(array $data) { and line 69 is the closing bracket at the end Link to comment Share on other sites More sharing options...
Juergen Posted April 4, 2015 Author Share Posted April 4, 2015 After uninstalling the PageEditPermission module the upgrade works as expected. I made the update and after that I reinstall the module once more. The error appear once more. I dont need this module at the moment, but this module causes the error. So it seems that it is not compatible with the latest version at the moment Link to comment Share on other sites More sharing options...
horst Posted April 4, 2015 Share Posted April 4, 2015 Hhm, the modules page does not have the flag for PW 2.5: http://mods.pw/34 Link to comment Share on other sites More sharing options...
Juergen Posted April 4, 2015 Author Share Posted April 4, 2015 Thats true but it worked quite well until this update. Anyway! My recommendation: Be careful if you use this module with wire version 2.5.25 - it brokes the site in my case Link to comment Share on other sites More sharing options...
horst Posted April 4, 2015 Share Posted April 4, 2015 Maybe you should post also into that module thread to put recognition on it. Maybe a post as a summarize from here or only just linking to this thread here: https://processwire.com/talk/topic/2074-module-page-edit-field-permission/ Link to comment Share on other sites More sharing options...
Juergen Posted April 4, 2015 Author Share Posted April 4, 2015 Its done: https://processwire.com/talk/topic/2074-module-page-edit-field-permission/page-2 Link to comment Share on other sites More sharing options...
Soma Posted April 4, 2015 Share Posted April 4, 2015 It's rather: be careful of using PW dev, it can break your site. You'd never update a live site without testing it in a dev environment first. Link to comment Share on other sites More sharing options...
adrian Posted April 4, 2015 Share Posted April 4, 2015 Until the core issue is fixed properly, simply wrap that entire function in: if (!function_exists('PageEditFieldPermissionConfig')) { That will get things working again for you. 2 Link to comment Share on other sites More sharing options...
cstevensjr Posted April 4, 2015 Share Posted April 4, 2015 I opened a Github issue regarding the PageEditFieldPermission Module, as per @Soma suggestion. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now