Jump to content

ridgedale

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by ridgedale

  1. @Tom. Thanks for the update. I've created the ready.php file and added the following code with and without enclosing it with <?php namespace ProcessWire; ?> to no avail. The user with the demo-admin role still has the permissions to make changes. <?php namespace ProcessWire; wire()->addHookBefore("Pages::moved", function($event) { if(wire("user")->hasRole('demo-admin')) { $this->error("Sorry. You do not have permission to move pages."); return false; } } wire()->addHookBefore("Pages::sorted", function($event) { if(wire("user")->hasRole('demo-admin')) { $this->error("Sorry. You do not have permission to sort pages."); return false; } } wire()->addHookBefore("Pages::cloneReady", function($event) { if(wire("user")->hasRole('demo-admin')) { $this->error("Sorry. You do not have permission to clone pages."); return false; } } wire()->addHookBefore("Pages::deleteReady", function($event) { if(wire("user")->hasRole('demo-admin')) { $this->error("Sorry. You do not have permission to delete pages."); return false; } } wire()->addHookBefore("Pages::publishReady", function($event) { if(wire("user")->hasRole('demo-admin')) { $this->error("Sorry. You do not have permission to publish pages."); return false; } } wire()->addHookBefore("Pages::saveFieldReady", function($event) { if(wire("user")->hasRole('demo-admin')) { $this->error("Sorry. You do not have permission to save field changes."); return false; } } wire()->addHookBefore("Pages::saveReady", function($event) { if(wire("user")->hasRole('demo-admin')) { $this->error("Sorry. You do not have permission to edit pages."); return false; } } wire()->addHookBefore("Pages::statusChangeReady", function($event) { if(wire("user")->hasRole('demo-admin')) { $this->error("Sorry. You do not have permission to unpublish pages."); return false; } } wire()->addHookBefore("Pages::unpublishReady", function($event) { if(wire("user")->hasRole('demo-admin')) { $this->error("Sorry. You do not have permission to unpublish pages."); return false; } } ?> I also note that my comment regarding modules and templates is irrelevant as non-superusers have no access to them by default. I'm not sure where I'm going wrong. Any thoughts appreciated.
  2. Correction: Just spotted that the maintainer user cannot log in and also that the maintainer field is not getting updated with the $maintainer username. ? The only way to regain access is to remove the if () statement from the admin.php, which then re-enables access for all users with a login account. Where am I going wrong!?
  3. I think the issue has been resolved by adding the following to the admin.php file above the require() statement: $maintenance = $pages->get("/site-upgrade")->maintenance; $maintainer = $pages->get("/site-upgrade")->maintainer; if ( $maintenance == 1 && $user->isLoggedin() && ! $user->name == $maintainer ) { $session->logout(); $session->redirect("/maintenance.html", false); } and changing the code in the header file to: $maintenance = $pages->get('/site-maint')->maintenance; $maintainer = $pages->get('/site-maint')->maintainer; if ( $maintenance == 1 && ! $user->name == $maintainer ) { $session->logout(); $session->redirect("/maintenance.html", false); } Is there anyway to get all the sites to drop into maintenance mode whenever maintenance mode has been switched on in any of the sites? That would greatly simplify the maintenance process. Any further thoughts appreciated.
  4. I've been trying to configure the maintenance mode implementation without success as follows: I created a template using a file named site-maintenance.php and added the following fields: maintenance (type: checkbox) maintainer (type: text) Both fields are set to be viewable by all users. The template itself is status: Hidden; viewable by all users; editable by role <site>-maint; no children allowed; no new pages allowed. I then created a page named site-maint using the above template and set its status to Hidden. What I am aiming to achieve is when any user tries to browse or login to the website the following check is run (added to the site header) to ensure when the maintenance checkbox is ticked only the administrator user whose username is stored in the maintainer field can access the sites while under maintenance: $maintenance = $pages->get('/site-maint')->maintenance; $maintainer = $pages->get('/site-maint')->maintainer; if ( $maintenance == 1 && $user->isLoggedin() && ! $user->name == $maintainer ) { $session->logout(); $session->redirect("/maintenance.html", false); } if ( $maintenance == 1 && ! $user->name == $maintainer ) { $session->logout(); $session->redirect("/maintenance.html", false); } The following code on the site-maint page appears to be working without any issue setting both the maintenance and maintainer status correctly: <?php namespace ProcessWire; // _site-maintenance.php template file, for managing site upgrades if ( ! $page->maintenance == 1) { $page->set('maintainer', null); $maintmessage = "Status: This site is not currently undergoing maintenance."; } else { $page->set('maintainer', $user->name); $maintainer = $page->get('maintainer'); $maintmessage = "Status: This site is currently undergoing maintenance by " . $maintainer; } ?> <div pw-append='content-body'> <?php echo $maintmessage; ?> </div> When users/guests browse the website they are now redirected as required. However, when I test logging in as another user whether a superuser or otherwise the user is still allowed to login. ? Any pointers to where I am going wrong would be greatly appreciated.
  5. Hi horst, Thank you for your helpful reply. I really like to keep the modules used to an absolute minimum. At present the only additional modules installed are Ryan's Database Backups and Teppo's Version Control, albeit one of the sites does also include Ryan's Twitter Markup Feed. All the latest versions are installed. I hadn't thought about the caches. I'll have to check how doing so might affect Database Backups and Version Control. The issue with both the Maintenance Mode and Protected Mode modules is that they both allow sites to be accessed by other users that have accounts. Anyone running a PW update must be certain that no-one else is able to access any of the sites while they are undergoing maintenance. Having tested Ryan's suggestion at the end of the Maintenance Mode Message topic: die("Go away! We are trying to upgrade the site."); I found that because the pages include the sidebar content from separate pages the sidebar content was still being loaded allowing a site to still be accessed through links provided there. That has lead me to the conclusion that the safest way is to redirect all other users (excluding the person managing the maintenance) to a maintenance page located at the domain root.
  6. @Tom. Thanks again for your feedback. I'll give that a try, test it and let you know how I get on. Does the wire()->addHookBefore("Pages::... also apply to modules and templates, as well as pages?
  7. Hi kongondo, Thank you for your reply. Backing up the databases and files is no problem. Every time significant changes are made I back everything up beforehand and afterwards. Replicating the site locally is problematic as I would have to setup a separate linux system to run the local hosting and specific software. My MacBook Pro already runs six separate operating systems. I have installed a local copy of the files running the same version of PW3 running under MAMP, but that installation runs older versions of the Apache and PHP software. Again I don't have a problem with this, but as I understood it I need to be logged in to the admin backend to check the progress of the upgrade for errors. Should I be doing that simultaneously for all 4 sites? I would also like to confirm whether or not the upgrade process makes changes to the database tables. Maintenance mode! I think is what I need to do, albeit if I put the sites into "maintenance mode" I'm not sure how I'll be able to access the sites remotely to test them. Diogo's and Ryan's methods at the end of the Maintenance Mode Message topic should help me with that! ?
  8. Hi Tom, Thanks again for your reply. That's correct. In addition to other restrictions that I think ought to be applied such as: with deleting, moving or sorting anything, adding, removing and configuring modules and adding, removing and editing templates. So taking on board your suggestion I am wondering whether or not it might be possible to implement this with the following logic: If the wire user does NOT ->hasRole('YOUR-ROLE') then if trying to install, configure, edit or delete anything exit; } else { $this->error("Sorry. You do not have permission to perform this action."); return false; } Are there any actions a superuser might have access to that you wouldn't want a guest potential superuser messing about with that I haven't covered?
  9. Hi Tom, Thank you for your reply. I'll bear that in mind in future. However, the thing is I do need the functionality that Ryan added to the latest developer version (3.0.107) he was working on yesterday, albeit I may wait until the next master version release. Ryan provided that information in his reply to the PW3 - User Trash Access topic. It would be really helpful to know what steps other multi-site webdevs take to implement multi-site updates. I understand the process of replacing the wire folder but my concern is that each of the sites need to be launched under the backend to apply the update, it would appear and there is always the chance that someone might be browsing one of the sites while the update is being processed and which might have disastrous consequences for the installation/update. Any further advice would be greatly appreciated.
  10. Hi Ryan, Firstly, thank you for Processwire and all the time and effort you have invested and thank you to the many others that help you support this community. Please could you advise when the next master stable version is likely to be released? As you will be able to see in this instance the multi-site installation is running an older master version of Processwire: version 3.0.62. I have raised a couple of related queries/topics that remain unanswered: The above is much more of an issue at present. I'm very wary about updating until I am sure of the correct procedure I should follow to update a multi-site installation. Any advice would be greatly appreciated. Setting up access to allow a potential administrator to view the backend without having edit/delete permissions - effectively to be able to view the everything including the edit interface without being able to make any changes - would be really useful.
  11. Reference: PW 3.0.62 and uikit3 based multi-site using the Regular-Master profile. I have multi-site installation where the individual site admins will not have superuser privileges owing to the overall site style, modules and templates needing to be managed and maintained by the webdev team. What I am subsequently trying to resolve how to give the site administrators access to the trash to be able to manage the retrieval of deleted pages, as required. Two levels of role have already been setup: <site>-admin and <site>-editor with the appropriate site permissions. The permissions for <site>-editor cover everything required for that role. The only thing missing is to allow a site administrator to retrieve deleted pages - only users with <site>-admin role are permitted to delete pages. I note that the Trashman module does not appear to be compatible with PW3x. It would be preferable not to use a module, if possible. Any assistance would be greatly appreciated.
  12. Hi Horst, Thank you for your reply. The sites are organised as one wire folder with multiple site folders each running site running off its own database following the guidelines for Option #1: Multiple Sites with Multiple Databases. I'm looking to update Processwire so therefore the intention was to simply replace the wire folder, but I'm unsure of is whether I should take all the sites offline while the sites are are updated and what the advisable procedure should be.
  13. Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile. I just wanted to check if there is a recommended procedure for updating multi-site installations. I've got 4 sites running off one installation running PW 3.0.62. Will back everything up before proceeding. Is it simply a case of following the standard update instructions and logging into and refreshing each of the sites one after the other? I'm a little concerned about people trying to access the sites while the update in progress. Any advice would be greatly appreciated.
  14. Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile. I have a multi-site running where I now need to start adding users. All my searches have drawn a blank regarding how to setup users with restricted permissions. In the first instance I would like to be able to give a potential site admin access to the backend with sufficient permissions so that s/he may be able to navigate round the backend to familiarise herself/himself with the interface without actually submitting edits, making deletions, changing templates, etc. Is it actually possible to do this? If so, could anyone give me an idea how I go about implementing this? What I tried initially was to give View and Page Edit permissions to the guest admin user but when I logged in as that user all that user is able to do is effectively view the website. When I ran a search for any modules that might help the returned hits all appeared to relate to old incompatible modules. An alternative solution I thought of would be to setup a duplicate of the live website that I could allow guest users to go in with full privileges, but I'm not really sure how it wold be best to go about that. I can see that I am rapidly needing to move from a simple multi-site setup to a demo / dev / staging / production setup for this group of sites. Any guidance would be appreciated.
  15. Hi louisstephens and dragan, Apologies for the very belated response and thank you for your replies. I wanted to be able to prevent the content from being displayed but keep the content on the page so it could be easily displayed at a later date when required without removing it. In the end I decided it might cause too much confusion with site editors, so I removed the content after creating a backup. No, I'm not. Apologies again. I'll bear that in mind in future. Thanks again to you both.
  16. Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile. I have a table that needs some of its content to be hidden. I've tried applying the following classes and styles to <tr>, <td> and <a> elements all without success: class="hidden" class="uk-hidden" class="uk-invisible" style="display:none" style="visibility:none" style="visibility:collapse" <-- only applicable to rows in this case Is there any way to allow a user to hide content? Any assistance would be appreciated.
  17. Hi Robin S, Your suggestion looks like it should fit the bill. Is it possible to reverse sort the repeater fields so the most recent year appears at the top of the list? Thanks again for all your input.
  18. Thank you for all your feedback, flydev, Robin S and LMD. I should have clarified that I have already setup a Parent page for the newsletters and the Children pages to each hold 10-years' worth of monthly newsletters - the newsletters go back to 1975 (the ones I've scanned and have yet to process) and possibly well beyond. See the screen grabs attached. The thinking behind a single folder hierarchy for the newsletter store is that, firstly, it would allow straightforward portability should the archive ever need to be moved, and, secondly, to facilitate the automatic display of the current newsletter based upon today's yyyy-mm date, provided it has been uploaded, or otherwise display the previous month's newsletter. The problem I foresee with storing the files as media attached to the Pages is that the paths to the files will not be predictable making the automatic displaying of the latest newsletter in the sidebar less than straightforward, if not impossible, and the newsletters will end up being scattered among many different folders meaning the portability of the archive would be less than ideal. Any further thoughts or suggestions would be welcome. Thanks again.
  19. Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile. I was wondering if it is possible to create an upload method that is not directly associated with any particular Processwire page so that a custom folder can be used from within the admin frontend to upload for example newsletters so they are stored in one hierarchical location to allow the latest edition to be automatically displayed using a single code call. What I'd like to be able to do is provide an upload method that allows a user to create year folders and upload newsletters to the relevant folders, making sure the uploaded files are named as required. Any input would be greatly appreciated.
  20. That's exactly what I have been doing ... searching the forums using the built-in search then following up with a Google search. I'll give that a try and have a hunt round the forums. Thanks. The iframe contains OpenStreetMap data. The contributors/users just need to follow the instructions how to add a location map for their group. The locations could be anywhere. If no URLs are entered, that section of code is ignored. Hope that makes sense. Thanks again for your assistance.
  21. Hi kongondo, Thank you for the reply and the topic link. My searches did not uncover that thread. A lot of my searches tend to return zero results, possibily because I'm entering too much information. It was very helpful to be aware of the potential issues in relation to allowing contributors/users the ability to enter code into fields. Having read through it all I decided to replace the field I setup to hold the iframe code with two fields the contributors can copy and paste the relevant URLs within the iframe code into them as the remainder of the iframe code is identical and it avoids any potential the security issues. Then I needed to do was replace the URLs in the iframe code on the template with the processwire code to load the data from the fields. Many thanks again.
  22. Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile. I wonder if anyone might be able to assist. I've setup a custom field to allow contributors to enter the html code to display an iframe. When I try to call the field nothing is displayed: echo $page->get("/contact")->urliframecode; When I inspect the element nothing is being passed to the web browser. If I enter the code directly in the template, the iframe is displayed correctly. I've tried configuring the custom field has been configured as type text area and as both Unknown/Text as well as Markup/HTML without any success. Any idea where I am going wrong?
  23. Thanks for the feedback and pointers, once again.
  24. Thanks for the reply once again, Robin S. I'm not sure this is what I am after as the site in question will have potentially many contributors and potentially many hundreds, if not thousands, of blog-posts (News items). A web search uncovered your experimental VirtualParents module which, at first glance, I thought might fit the bill exactly. The fact that it cannot be used for real children or on actual production websites precludes it from implementation. In essence, if thousands of posts are listed ungrouped below Blog (News in this case) I'm very mindful of the potential that clicking on Blog (News) to display the list of posts would have a significant impact on the performance of the website from a contributor perspective. What I'm hoping to achieve is for the posts to be returned automatically as collapsed groups by year or year/month and then when the group is clicked that the posts are listed in sort order by the custom field currently specfied using the Templates > News (blog) > Family (tab) > Children are sorted by option as follows: News (blog) 2017 3rd Post Title 2nd Post Title 1st Post Title 2016 2015 .... or: News (blog) 2017 2016 12-December 11-November 10-October 3rd Post Title 2nd Post Title 1st Post Title 09-September 08-August 07-July 06-June 05-May 04-April 03-March 02-February 01-January 2015 .... Is it possible to achieve such automatic page listing with Lister or ListerPro without requiring contributors to run filters?
  25. @benbyf Thanks for the feedback. @BitPoet I'll do that. Thanks, guys.
×
×
  • Create New...