Lars282

Members
  • Content count

    139
  • Joined

  • Last visited

Community Reputation

22 Excellent

About Lars282

  • Rank
    Newbie

Profile Information

  • Gender
    Male
  • Location
    London, UK; Frankfurt, Germany
  1. Thanks! Seems to be the issue that render check if the page is viewable, as when the page is in any other status, the code works fine. Still surprised that this returns a 500 internal server error. If $page->render checks if the page is viewable, is there any other way to display an unpublished page? Publishing and keeping the page hidden might work, but will involve additional steps of hiding / unhiding the page ...
  2. Hi, I am trying to give my editors the option to share unpublished pages with externals for review, without moving or copying the actual page in the admin. I have now created a draft template, that has one field (a page). Whenever the draft template is accessed, it should render the page selected in that field. This works fine as long as I am logged in. When I am not logged in, the $page->render() on the unpublished pages leads to 500 internal server error. Any idea why? Below the code I am using. Can I use $page->render() on unpublished pages? Thanks! Lars <?php if($page->draft_article) { //draft_article is the field where I select the article to be shown $out = $page->draft_article->render(); //when the page selected in draft_article is unpublished, guests get a 500 error with this line echo $out; } else { echo 'No article selected.'; } ?>
  3. So I have created a small module to do this. In addition to preventing users from logging in, I also want to log out everyone, but cannot get this to work - does anyone have an idea why it does not log users out with the code below? Preventing login works fine. Am I hooking wrong? Thanks! <?php /** * */ class SessionLoginDisable extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Session Login Disable', 'version' => 001, 'summary' => 'Provides option to disable login for all users except superusers.', 'author' => 'Lars Bergemann', 'autoload' => TRUE, 'singular' => TRUE ); } public function init() { $this->addHookBefore('Session::allowLogin', $this, 'allowLogin'); $this->addHookAfter('Session::isValidSession', $this, 'isValidSession'); //no effect currently $this->addHookBefore('ProcessLogin::execute', $this, 'disableLoginNotice'); } public function allowLogin($event) { $name = $event->arguments[0]; $user = strlen($name) ? $this->wire('users')->get("name=$name") : null; if(count($this->disable) > 0 && $user && $user->id && !$user->isSuperuser()) { $event->replace = true; return false; } return null; } public function isValidSession($event) { if ($event->return) { $userID = $event->arguments[0]; $user = wire('users')->get($userID); if (count($this->disable) > 0 && $user && $user->id && !$user->isSuperuser()) { $event->return = false; } } } public function disableLoginNotice($event) { $this->error("Login currently disabled."); return null; } }
  4. The maintenance mode module handles this on a per role basis so far more than what I would need. I'll use the hack for now and might make a small module for the future.
  5. Hi all, Is there a way to easily lock out all from login into the admin except superusers? I could not find anything on this issue. I could write a small module, but I am sure that i am not the first person that needs this? We have a larger site with multiple users maintaining content. I want to copy the entire site to a staging server, make some changes (setup of fields), test them, and copy the site back to production. I want to temporarily lock all users out so that the content does not change on production system between the copies. Or is there a better way to do this? Thanks Lars
  6. Any ideas on where I should start?
  7. For the PageTable field, when allowing lots of templates, I think there should be some space between the rows of buttons. See for example:
  8. Lars282

    disallowedContent: *[*]{*} is what I would use. Does that make sense?
  9. Lars282

    Maybe I just don't get it ... but following this logic, how do I strip all style attributes from all tags? Would *[*]{*} work? Edit: seems to work - or do you see any issues with this?
  10. I have tried adding disallowedContent: *[style] to the Custom Config Options with ACF on, but it throws a JSON validation error. Where am I wrong?
  11. For a PageTable field, I have selected multiple templates that are allowed as items, and I entered an automatic page name format. It seems that even though this can be entered, the automatic page name format only applies in the same circumstances as for when adding pages, i.e. when only one template is allowed as child. 1. I would suggest to add the following to the description for automatic page name format entry for PageTable fields: "In order to work, a single (1) template must be selected for the "Select one or more templates for items" field on the Details tab." 2. How can I get around this restriction? It is for maintaining parts of a page, where the name really does not matter at all - and it is only confusing my users that they need to enter just anything to proceed. I am assuming this will be "solved" for PageTable fields as soon as it is "solved" for adding pages in general - I looked into this before but go stuck: https://processwire.com/talk/topic/9979-name-format-for-children-for-multiple-allowed-templates-for-children/ Can someone help on where to hook to in order to also "catch" pages that allow multiple templates as children in order to jump the Add Page screen? Thanks a lot!
  12. Is there already a way to hide the 'new' button next to pages where it is not allowed to add new child pages (as no templates allowed)? Or is this on the roadmap somewhere? This would be to prevent this error from ever showing to an admin user:
  13. Just having the same issue - did you find a solution to this?
  14. How can I enable to name format for children option when allowing multiple templates for children? In other words, where is it best to hook into? I am already hooking before setupPageName to derive my custom page names: addHookBefore('Pages::setupPageName', $this, 'deriveCustomPageName') But there is something before that is responsible for "jumping" the name entry screen. I found processQuickAdd in the ProcessPageAdd module, but it is called from the ___execute() function - so I can't see how to easily change the conditions on when it shall be called without having a module more or less replace the entire core ProcessPageAdd module, which seems over the top ... Thanks a lot!
  15. Lars282

    Haven't seen this before, but looks like what we need. Does Page Table handle pagination similar to the page tree?