Jump to content

Lars282

Members
  • Posts

    144
  • Joined

  • Last visited

Everything posted by Lars282

  1. Thanks, rick. It seems I only had to update the config with the new DB details. Anything I could have missed in the htaccess? Saw this part, but did not need to change anything: RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] # ----------------------------------------------------------------------------------------------- # 500 NOTE: If using VirtualDocumentRoot: comment out the one above and use this one instead. # ----------------------------------------------------------------------------------------------- # RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA]
  2. Hi all, We currently have two websites (domain1.com and domain2.com) running on PW with 2 separate hosting accounts. As domain2.com is no longer regularly used (but should be kept online for reference), the plan is to move it as an add-on domain to the hosting of domain1.com (domain2.com will stay in used, but use a subfolder of domain1.com). After setting up the add-on domain, can I just migrate the files of domain2.com (old PW 2.4) into the subfolder of domain1.com, and copy over the database? Or do I need to take extra steps to make sure that the two instances of PW do not interfere, e.g. in the config files? Thanks a lot for your help and Best Lars
  3. Hi. For some reason, without doing any changes on my part to the PW install over the last 2 years, the image extra field that I had set up disappeard just now from the edit page: I have setup the image field with a custom text input as follows: But I do not see this with the image when editing a page: In the database, the field is available and filled for all "old" pages that were created a while back: [Note: I have just now, after the issue occured, manually changed the default in the table from None to "" as it otherwise would not have allowed me to upload any new images] Did anyone encounter this before? How do I get the field back to show when editing pages? Any help would be highly appreciated! Best Lars
  4. I haven’t touched the install at all ... Where do you see this? Is there a (temporary) „quick fix“ that you can see? Change this column to optional? Change the database column to accept null values and put default to null? Will also move this to the image extra spaces. Thanks a lot for your help, highly appreciated!
  5. Hi. I am suddenly receiving an error on a production site that has worked perfectly over the past years. When uploading an image to a field called article_images, I receive the following error: I had set up this field to accept an additional value for "Credits" with each image: This is also reflected in the database: I have not made any changes to the setup/settings in the past years. Does anyone have an idea on where this could be coming from now and how to fix it? Any help would be highly appreciated! Lars
  6. 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 ...
  7. 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.'; } ?>
  8. 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; } }
  9. 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.
  10. 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
  11. For the PageTable field, when allowing lots of templates, I think there should be some space between the rows of buttons. See for example:
  12. disallowedContent: *[*]{*} is what I would use. Does that make sense?
  13. 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?
  14. 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?
  15. 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!
  16. 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:
  17. Just having the same issue - did you find a solution to this?
  18. 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!
  19. Haven't seen this before, but looks like what we need. Does Page Table handle pagination similar to the page tree?
  20. Hey We want to create an "infinite" feed as a home page, consisting of manually created building blocks / rows. It won't be infinite, but grow over time as new building blocks / rows are added to the top of existing ones. Each building block / row can be a PW page and this works well, but maintenance seems not so user friendly. Is there an easy option in PW admin to have simple drag-and drop for ordering the building block pages (similar as it is possible in the page tree), but to have some more visual representation of each page, or at least more rows with details of the individual fields? Only having one line in the page tree makes it quite hard to identify the building block that one wants to edit or move. Happy to build my own module for this, but is there something existing that can be reused / adjusted? Thanks a lot Lars
  21. Hey Probably this has been discussed before, but could not find anything using the search ... ?! How do you guys setup separate development and live systems with PW? Once the site is live, I prefer to have a separate development domain to try out any changes. What is the best way to move changes on the development system to the live site with PW (i.e. fields, etc.)? I.e. how to move all new fields and templates, changes to the admin, etc.? Thanks a lot Lars
  22. It seems that the issue was with how I got the arguments. I replaced $page = $event->object; $options = $event->arguments(0); with $page = $event->arguments[0]; $options = $event->arguments[1]; and then it worked as required ... Using the anonymous function is also part of the documentations somewhere and explicitly shown as an alternative for newer versions of PW / PHP.
  23. I have started with a module like below, but it seems that the $page is not correctly available inside my function... If I take out template check, I get some error about parent() not being a correct method in the context, but if I leave the check in, it always returns to the core function and proceeds as if I didn't have the module in place. Can it be that I need to assign the $page somehow different? Also, the setupPageName method edits the $page object - do I also need to specifically a´return the edited page from my module, or is it enough to simply edit it attributes? Thanks a lot Lars public function init() { $this->addHookBefore('Pages::setupPageName', function($event) { $page = $event->object; $options = $event->arguments(0); // check if the page belongs to templates to be considered, and if not, return to core function if($page->template != 'mytemplate') return;
  24. This is exactly what I was looking for - thanks for the hint with the three underscores, I will give it a try.
×
×
  • Create New...