Jump to content

PWaddict

Members
  • Posts

    926
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by PWaddict

  1. I'm trying to empty the trash with a hook but it's not working: $wire->addHook('LazyCron::everyMinute', function() { $trashed_pages = wire('pages')->find("parent=/trash/, include=all"); if(count($trashed_pages)) { $trashed_pages->emptyTrash(); } });
  2. I would like to change the "Move to Trash" text from the Delete tab only for non-superusers. Any ideas how to do that?
  3. Maybe this the hook ProcessPageView::pageNotFound you need.
  4. No need for alt 404 template. if($page->isUnpublished() && !$user->isSuperuser()) { $error404 = $pages->get(27); // ID of 404 page $session->redirect($error404->url, false); // 302 temporary redirect }
  5. I had to create an alternate template for 404 page and now it works: if($page->isUnpublished() && !$user->isSuperuser()) { $error404 = $pages->get("template=404-alt, include=hidden"); $session->redirect($error404->url, false); } If you know a better way let me know. Thanks.
  6. I've also tried this but isn't working. I'm getting a blank white page. if($page->isUnpublished() && !$user->isSuperuser()) { $error404 = $pages->get("template=404, include=hidden"); $session->redirect($error404->url, false); }
  7. Guests can't view them. I was talking about the site editors (non-superusers). I've already tried that but something isn't right. The site editor can see a 404 page (which is what I want) but lot of pw related content is hidden like titles, other fields content etc.
  8. PW by default allows non-superusers to view unpublished pages on frontend. Is there an option somewhere to prevent that?
  9. I solved it ? $client = $roles->get('client'); $s_template = $templates->get("my-template"); if ($page->my_checkbox) { if ($client->hasPermission('my-permission')) { $client->of(false); $client->removePermission('my-permission'); $client->save(); $s_template->revokePermissionByRole("page-add", $client); $s_template->save(); } } else { if (!$client->hasPermission('my-permission')) { $client->of(false); $client->addPermission('my-permission'); $client->save(); $s_template->addPermissionByRole("page-add", $client); $s_template->save(); } }
  10. Here is the first part for simply removing/adding a permission from specific role: $client = $roles->get('client'); if ($page->my_checkbox) { if ($client->hasPermission('my-permission')) { $client->of(false); $client->removePermission('my-permission'); $client->save(); } } else { if (!$client->hasPermission('my-permission')) { $client->of(false); $client->addPermission('my-permission'); $client->save(); } } @Zeka What I don't understand is how to remove permission "page-add" from template "my-template" from role "client".
  11. Here is what I want to do: if ($page->my_checkbox) { //Remove permission "my-permission" from role "client" //Remove permission "page-add" from template "my-template" from role "client" } else { //Add permission "my-permission" on role "client" //Add permission "page-add" on template "my-template" on role "client" } I would really appreciate your help.
  12. Done ? $css = '.PageListStatusUnpublished .PageListActionSelect, '; $css .= '.PageListStatusHidden .PageListActionSelect, '; $css .= '.PageListID7, '; // Hides the Trash page
  13. @Robin S The Trash page itself is selectable but I fixed it by adding .PageListStatusHidden in the hook so now non-superusers can't select the Trash page itself or any other hidden page: $css = '.PageListStatusUnpublished .PageListActionSelect, '; $css .= '.PageListStatusHidden .PageListActionSelect, '; Now only 1 issue remains. The pages inside Trash are selectable.
  14. @Robin S How to prevent selection of Trash page and unpublished pages?
  15. I tried your second hook and I'm getting the following errors: Notice: Undefined variable: template in C:\xampp\htdocs\mysite\site\ready.php on line 131 Notice: Trying to get property of non-object in C:\xampp\htdocs\mysite\site\ready.php on line 131
  16. I've updated PW to 3.0.118 on localhost and this is what I see in the admin login screen:
  17. That result in a 500 server error. I changed it to the following and now I'm getting the proper time on backend's creation, modification, installation times etc. $config->dbInitCommand = "SET NAMES '{charset}', time_zone = '+02:00' "; Your DatetimeAdvanced module helped me with that ?
  18. According to the following @ryan post from 2013 the info field is not affected by the timezone.
  19. I tried date_default_timezone_set('Europe/Athens'); but still on the backend when a page is getting saved it says 6 hours ago on the "last modified".
  20. Nope. Already tried that. Timezone and locale are different things.
  21. I have 1 server in Canada and multiple client's pw websites from different countries hosted on that server. How can I set on each website to have client's correct timezone? I thought $config->timezone in site/config.php should do that but it doesn't. For example 1 website is from a client in Greece so I'm using this: $config->timezone = 'Europe/Athens'; but when a page is getting saved on the "last modified" info says 6 hours ago. That's the hour difference between Greece and Canada.
  22. @kixe I replaced value$langID|title$langID with title$langID and now it works properly.
  23. @kixe I've added on the options field all the options in all languages and now the page names for alternate languages are getting updated. The problem is that the option value is getting injected on the page names instead of the option title.
  24. With the 2.1.2 the page is getting saved but when I'm editing the related fields the page names for alternate languages are not getting updated.
×
×
  • Create New...