Wow. Is it that easy?! That’s amazing. I can’t wait to try it out. I’ll post back with results. Thanks very much Sottwell.
Paul
-
☆ A M B ☆
- 24,524 Posts
Good luck! I hope it works, or that somebody better in the core than I can make it work.
... or stop coding for a minute and just look around...
feedburner does ping all blogging platforms automatically (and also adds many other things to your feeds)
That’s an immediate solution but I still believe automatic pinging is an important thing to include in a feature-list for new users evaluating MODx;
I guess over 50% of them would be interested in just blogging, and eventually discover later on MODx is a more powerful framework.
using this event someone must still visit that page for the event to get fired (or you neet a cron yob to check all your pages?) the page is published not on the exact date but on the date / time after the publish date when someone tries to look at the page (maybe the menubuilder looks to the publish date as well? or does modx check publish / unpublish dates every time a page is viewed?
Dimmy
-
☆ A M B ☆
- 24,524 Posts
MODx checks all publish/unpublish dates at every page view. It uses the assets/cache/sitePublishing.idx.php file.
Ahh. I think that explains the problems I was having...
I tried to get the automatic pinging to work a while back but I gave up because I thought I hadn’t succeeded and didn’t have the time to find out where I was going wrong, but maybe I had succeeded after all...
I can confirm that Sottwell’s method for adding a new event called ’OnBeforeDocAutoPublished’ works. The code she provided for the modification to the document.parser.class.inc.php works fine. The thing that I thought I hadn’t got to work was the code for the plugin itself. I found a few typos in it which I corrected, but nevertheless, it ’seemed’ to be preventing MODx from auto-publishing. In order to test it I was waiting for the publish date to be reached and then looking for an email to get sent to me confirming that the event was being fired... but the document wasn’t being auto-published and the email wasn’t being sent. I thought that I had made some error that had broken MODx so I undid the changes. Now I realise that it probably wasn’t auto-publishing because I wasn’t viewing any pages, not because of an error in the code - I didn’t realise that this was necessary for an auto-publish. I was just waiting. I might take another look at it now.
The whole point about the ping however, is that it notifies people that new content exists. For sites which don’t have many visitors or don’t publish frequently, then if people don’t know that the new content exists, then they might not visit the site, and since no-one is viewing the site, the ping might never be sent notifying them of it. Chicken and the egg etc.
Still, it’s much better than no automatic pinging at all. I currently drive the pinging by having an unpublished page with a button on it that I log in, preview and press to send the ping.