On Page Version Approve Issues

Permalink
So it seems that I'm having problems with getting the on_page_version_approve event listener to run properly..

added to config/site_events.php:

Events::extend('on_page_update', 'myclass', 'myfunction', 'libraries/approval_mods.php');


and to libraries/approval_mods.php:

class myclass {
   public function myfunction($page) {
      //$location = $page->getCollectionPath();
      $file = $_SERVER['DOCUMENT_ROOT']."/testFile.txt";
      $fh = fopen($file, 'w');
      fwrite($fh, 'test text');
      fclose($fh);
}
}


Doing this sort of thing seems to work with on_page_add but not with on_page_version_approve.

I'm running 5.4.2.1 but last I checked, on_page_version_approve is installed there. (libraries/events.php)

Oh yea, I also downloaded Mnkras' Event Tester:
https://github.com/Mnkras/Event-Tester/...
- Absolutely brilliant stuff

The logs say that on_page_version_approve is firing.. But no file is written.

Anyone got any ideas why??

 
cowland replied on at Permalink Reply
Ok well it turns out that it was my version of C5... Could've sworn that it's installed in 5.4.1.1 thou - libraries/events.php, line 66..

Anyway, upgraded to V5.4.2 and it's now working =)

- for those of you who did the request.php hack remember to delete it, seems they've fixed this issue nicely in the new version!

All very good stuff!!