suntrop

Members
  • Content count

    249
  • 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,353 profile views
  1. suntrop

    Oh cool, this look quite different to what I had before I am using 3.0.98. I just copied the module and seems to work fine. Thanks for that!
  2. suntrop

    At the moment I just hacked inside the module directly to change from user name to useremail. There is useremail input field (in PHP comments) what I am using. Works fine, email was sent. However, I need to move this module to my sites directory, so it won't be overwritten the next update. Perhaps I can code something and PR to Ryan to update the module
  3. suntrop

    I am currently looking at the module's code and realised the same. I configured the Login/Register module to use an email rather than a username to login. It seems this function is not compatible to the forgot password module. Is it possible to copy the module from wire/modules to site/modules and edit the module's code? I would add a reset by email before coding a new, own reset function,.
  4. suntrop

    Thanks, I put in a hook.
  5. I am using the Login/Register module and have enabled the forgot password feature and the ProcessForgotPassword module is installed as well. When I enter an email to reset the password, no email is sent. I noticed there is a 'process_forgot_password' table in the DB … with no rows. Other emails are working well, just the forgot email is not working.
  6. I want a field to be required only if the page is published. I tried published=1 published=true and status=published but seems to be not working like that. Any way I can bind the 'required if' on the page status?
  7. Well, that makes sense I thought there is something wrong, but if that’s right it is ok thanks
  8. 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).
  9. 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
  10. 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()?
  11. 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: https://processwire.com/api/hooks/#read_arguments 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)?
  12. 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.
  13. 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
  14. 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
  15. I get this notice when using markup cache It is more or less the same from https://modules.processwire.com/modules/markup-cache/ $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?