• Content count

  • Joined

  • Last visited

Community Reputation

41 Excellent

1 Follower

About suntrop

  • Rank
    Sr. Member

Profile Information

  • Gender
    Not Telling
  • Location
    Germany, Cologne

Recent Profile Visitors

3,251 profile views
  1. Well, that makes sense I thought there is something wrong, but if that’s right it is ok thanks
  2. I am wondering why I need to add check_access to filter user roles // $page->members is a Page reference field to users $members = $page->members('roles=staff, check_access=0'); // output: 4 (for none superusers) $members = $page->members('roles=staff'); // output: 0 (for none superusers, but 4 for superusers) The members field is just a list of people belonging to a certain group. The group is split into users with the role 'staff' and those with just a 'member' role. I want to get only those with the staff role (and later those without that role).
  3. So, if I create hooks with the pure purpose of passing $event to other private methods, "it is ok"? On my current example above the tricky part is, almost everything builds up from the tierprice, wich in return builds up the unit price, wich builds the price, … Sometimes I need the total, sometimes I need to get the unit price and sometimes I need the with or without VAT. Like a pyramid. On my very first draft I had a couple functions in _function.php, then I moved on to create all sorts of different/independent hook methods but a lot of methods did the same thing, just with some slightly other output. At the end I thought, what I nice idea to just pass always the $event around
  4. Thanks a lot! The first point took me some time, but it is really obvious now The second one though isn't that clear to me. I have code more or less like your example but thought passing the $event always is better, because I can use those methods on its own. While it isn't necessary in the code section above, I have quite a couple of methods I need/want to use directly. I could create a hook for tierprice() as well, and call it $page->tierprice($page, 3) — but this seems wrong to me too. You would create a new method like getTierprice() which in return calls the private method tierprice()?
  5. Hi all I am working on my knowledge of PW's hooks … and maybe on PHP OOP in general Now I have got two questions on this hook: // From basic-page.php template $page->price(3, true); // From my module's init() $this->addHook('Page::price', $this, 'price'); // and the method function price($event) { $page = $event->object; $quantity = $event->arguments(0); $vat = $event->arguments(1) ?? false; // Get tier price $unitprice = $this->tierprice($event); $event->arguments(1) = $unitprice; // possible/correct? if ($vat) $unitprice = $this->addVAT($event); return $unitprice; } FIRST Why does the PageArray comes from $event->object and where do know this from (beside just copying code from other forum posts ) And why is $event->arguments(0) the first variable I pass to my method and not the $page as it says on that doc page: SECOND I would like to pass the complete $event (the $page and my arguments) to the addVAT() method. But in that method I need the $unitprice as well. Is it possible and the correct way to just create a new third argument ($event->arguments(2) = $unitprice)? Or do I need to write something like $unitprice = $this->addVAT($event, $unitprice)?
  6. suntrop

    I had something similar but changed quickly to PayPalˋs Rest API. You can create subpages on the order pages, or use the repeater field. If you just want to store for technical reasons and „maybe we need to look at“ you can use PW log system and just log the response.
  7. suntrop

    I might be wrong, but there is an option on the home template, right? You can force to use only HTTPS. But I don’t know if this passes the option down to child pages
  8. Thanks, didn't know WireCache before. I googled for cache and top results were all markup cache. The Notice however was the same, but it turned our, it came from $page->children('limit=499') When I remove the limit there is no notice. Luckily I don't need that limit
  9. I get this notice when using markup cache It is more or less the same from $cache = $modules->get("MarkupCache"); if (!$data = $cache->get("tablerows__pageid_" . $page->id)) { $data = ''; foreach ($page->children('limit=499') as $child): $data .= '<tr>'; $data .= '<td>'; $data .= implode(" | ", $child->title); $data .= '</td>'; $data .= '</tr>'; endforeach; $cache->save($data); } // output cached table rows echo $data; Is there anything wrong or has something changed? Do I need to check if the cache file exists?
  10. suntrop

    That is what I was looking for. I did not know there is a context menu for tables. I tried to select the table and click the toolbar button (like it works for links and images). Thanks!
  11. When an editor adds a table you can insert a CSS class width, etc. But once the table is inserted I can't find any way to change any of the "meta data" like class, id, width, etc. Usually I provide some table designs (table-a, table-b, table-hover) and the editors can choose one. But if there is a big table and the editor wants to change it, there is only HTML where one can edit that. Or do I miss something here?
  12. suntrop

    Thanks for your help! No cPanel, a custom made tool. I had installed Tracy Debugger, but couldn't see anything wrong. Maybe I will check the ProDevTools. On monday I will see t get in touch with someone else. Unfortunately there is no monitoring but I do have rights to install software. Had New Relic on my mind, but you link looks like a quite nice list. I am not that familiar with installing apps on the terminal, but I can clone the server and "test ruin" everything No, there is nothing new the last 30 days. It is a rather small business website. Just usual pages like "About", "Team" etc. There is almost nothing special in there. I will check on MySQL! Currently the site works fine. But I increased memory to 4 GB. I find it hard to believe I am using 4 GB for a tiny website
  13. suntrop

    Hi guys Since last night I have trouble with my cloud server. It is a VPS with 2 CPU, 2 GB RAM and just one small website installed (about 30 pages, nothing fancy and less than 50 visitors/day). I am not a server expert, but I would believe these resource should be fine for PW (3.0.42). The hosting company just blames the website script and something uses too much RAM. It worked fine the last six month and I didn't change anything the last 30 days. Is there anything I can do to double check?
  14. I need for an web app files that keep their original names. Like “A new flavour from Häagen-Dazs.pdf”. Why? Because my web app is some kind of file sharing (for a company) and those files need to be re-integrated into their original place. The company uses a DMS that partly relies on file names. If they get back “a-new-flavour-from-hagen-dazs.pdf” it’ll break consistency. I tried but couldn’t get rid of the file name validation. Is it possible to disabled it? I couldn’t find a hook for file uploads. Is it possible to hook into it and change back the original name? ... or instead, save the original name in the file description? So when I download the file I can pass in the original name? Another ugly way would be to just store file paths in a multiplier or just a folder path (but that excludes admin users uploading files within PW) I read a blog post by soma with an interesting solution to store files as a dedicated page. This would come in handy, because I need to manage access on all files anyway. Most files are coming from and front end upload form. But the admins will work on the PW backend and that is quite combersome to create for every file a new page, name it accordingly, upload the file and create a reference. On github I found a workaround by @matjazp but the Dropbox link isn’t working anymore.
  15. Well, of course. If I know what I am doing I will go through the code at the weekend. As mentioned on my first post above, there are two challenges. The other is completely different, so I’ll create new thread. Hopefully you guys can help there too