-
Posts
926 -
Joined
-
Last visited
-
Days Won
1
Everything posted by PWaddict
-
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(); } });
-
Maybe this the hook ProcessPageView::pageNotFound you need.
- 4 replies
-
- 2
-
- 404
- pagenotfound
-
(and 1 more)
Tagged with:
-
[SOLVED] How to Add/Remove permissions via API?
PWaddict replied to PWaddict's topic in API & Templates
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(); } } -
[SOLVED] How to Add/Remove permissions via API?
PWaddict replied to PWaddict's topic in API & Templates
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". -
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.
-
CKE pwlink: pages without templates shouldn't be selectable
PWaddict replied to Klenkes's topic in General Support
Done ? $css = '.PageListStatusUnpublished .PageListActionSelect, '; $css .= '.PageListStatusHidden .PageListActionSelect, '; $css .= '.PageListID7, '; // Hides the Trash page -
CKE pwlink: pages without templates shouldn't be selectable
PWaddict replied to Klenkes's topic in General Support
@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. -
CKE pwlink: pages without templates shouldn't be selectable
PWaddict replied to Klenkes's topic in General Support
@Robin S How to prevent selection of Trash page and unpublished pages? -
CKE pwlink: pages without templates shouldn't be selectable
PWaddict replied to Klenkes's topic in General Support
I copied your code again and now it works. -
CKE pwlink: pages without templates shouldn't be selectable
PWaddict replied to Klenkes's topic in General Support
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 -
-
[SOLVED] How to set database timezone on Shared Servers?
PWaddict replied to PWaddict's topic in General Support
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 ? -
[SOLVED] How to set database timezone on Shared Servers?
PWaddict replied to PWaddict's topic in General Support
According to the following @ryan post from 2013 the info field is not affected by the timezone. -
[SOLVED] How to set database timezone on Shared Servers?
PWaddict replied to PWaddict's topic in General Support
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". -
[SOLVED] How to set database timezone on Shared Servers?
PWaddict replied to PWaddict's topic in General Support
Nope. Already tried that. Timezone and locale are different things. -
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.
-
@kixe I replaced value$langID|title$langID with title$langID and now it works properly.
- 100 replies
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
@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.
- 100 replies
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
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.
- 100 replies
-
- template
- autogenerate
-
(and 2 more)
Tagged with: