Jump to content

benbyf

Members
  • Posts

    811
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by benbyf

  1. Cron is working as it's printing to the logs so must be not finding the pages or something. Havent used $log before, and im an idiot for not, so thanks for the push in that direction for debugging.
  2. now added the $page, but still cant seem to get cron to fire. is the a simple thing to do to check if LazyCron is even working? thanks
  3. sorry my bad, i left out another function: public function publish($page) { $page->removeStatus(Page::statusUnpublished); $page->removeStatus(Page::statusHidden); $page->Save(); }
  4. Hi, I'm trying to add a hook to lazycron in my module that finds all pages with a checkbox and then sets less the seconds passed to another field, but as yet have seen anything happen. public function init() { $this->checkboxName = "pdp_pub_later_check"; $this->fieldName = "pdp_pub_later"; $this->addHook("LazyCron::everyMinute", $this, 'publishDefferedPages'); } public function ___publishDefferedPages(HookEvent $e){ // seconds since last lazycron $seconds = $e->arguments[0]; // find all pages with deffered field $defferedPages = $this->pages->find("{$this->checkboxName}=true"); // for each page decrease time for deffered field foreach ($defferedPages as $page) { // get current page time $timeTillPublish = $page->get($this->fieldName); // set time to time minus time past $timeLeft = $timeTillPublish - $seconds; // if time passed 0 or less then publish page $page->of(false); if($timeLeft <= 0){ // remove flags and save $this->publish(); $page->set($this->fieldName, 0); }else{ $page->set($this->fieldName, $timeLeft); } $page->Save(); $page->of(true); } }
  5. Will try your module for sure! Mainly wanted to know if my solution was a bad one too
  6. anything on spam filtering at all in this thread? Love the simple form but was wondering if there was a good rule of thumb for preventing bots. Currently I use a javascript solution that adds a small bit of missing information to the form after 1 second on the front end which it checks for when posted.
  7. Thanks @LostKobrakai I was able to pull my button name as a bool from the page input. $this->postPubLater = $this->input->post('my-submit-btn-name');
  8. RT @situationsUK: Looking for somewhere to make, create and explore ideas in Bristol? Talk to @_SpikeIsland https://t.co/iKnbJqPgcK https:/…

  9. @jonpearse @MrBandFriends available

  10. Hi, I've managed to add a new button to the edit page but i'm finding it difficult to catch when it's been clicked. I've attached an image with the new publish later button with the name pdp_pub_later, but when I message() the action its always ProcessPageEdit – who would I find out that my new button has been clicked? public function init() { $this->addHookAfter("ProcessPageEdit::execute", $this, 'publishLaterAndRedirect'); } public function publishLaterAndRedirect(HookEvent $e){ $page = $e->page; $action = $e->action; $this->message('action:' . $this->process); }
  11. https://t.co/isO2gDtdPJ super amazing politics and Philosophy from @BBCRadio4 unpacking the UK system and politics generally

  12. quick video to explain my CLICK BATTLE game using the #BBCmicrobit @BBCMIDigital https://t.co/PW7bNTtGnQ https://t.co/vq7N5BNHib

  13. Please write a review on #iTunes for The Machine Ethics podcast. thanks https://t.co/zwADynICEn

  14. RT @teppokoivula: ProcessWire Weekly #116 – https://t.co/2H33jCypUS #ProcessWire #PHP #CMS #CMF

  15. Thanks for the shout out about my tutorial in @processwire weekly https://t.co/ij3v0V2oJF #moduleWriting #webdesign https://t.co/aQcAqIgfnX

  16. RT @LawOfDriverless: Interviewed by @benbyford of the Machine Ethics podcast, about #law and #driverlesscars . Listen here: https://t.co/Ss…

  17. Loving the videos you get at the end of #subterfuge second still the best I've got as far. #MobileGames https://t.co/Lb1mtpryRx

  18. RT @THECUBELondon: if you are in #Bristol + looking for #coworking, check out this survey for a new space in the city https://t.co/m8MKdL2e…

  19. RT @mikebutcher: For just 3 minutes, experience what it's like to use the phone of a refugee https://t.co/ljxsvsZQey #techfugees

  20. RT @jesslynnrose: Looking for a female London game dev who might be interested in being connected to a lovely student needing mentorship!…

  21. This is genius, thanks @horst. Also thanks for all the tuts jokes... I never thought of myself as a backend guy so hope they're up to scratch and I always comments. @kongondo this is great http://kongondo.github.io/ProcessWireAPIGen/dev/class-Field.html thanks.
  22. Finding it quite fustrating work with fields from a module, I cant seem to find any good docs or forum threads. For example I'm making a new field on install of my module, but ideally I would like to know how to set flags, default value, max- min etc for that field but it's not obvious to me. All I can mange so far. $f = new Field(); // get a field type $f->type = $this->modules->get("FieldtypeInteger"); $f->name = $this->fieldName; $f->label = 'Publish Page later'; $f->save(); // save the field I'm finding this elsewhere with integrating with the admin, but not at all with the API itself which has great documentation. Any advice, guidance would be great!
  23. RT @TeddyDief: "Black Gold" by @conormn: beautiful surreal slice of life. Take 5 min to play this https://t.co/JMMCGIi7Ct https://t.co/PlrQ…

  24. How does one set a new field's global flag in a module? i.e. // create new field object $f = new Field(); // get a field type $f->type = $this->modules->get("FieldtypeCheckbox"); $f->name = $this->fieldName; $f->label = 'Publish Page later'; // somehow set flag to global??? $f->save(); // save the field
×
×
  • Create New...