Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[request] ping when post "goes live", not when published
This may not be possible… but I need to ask it anyhow.
Will the plugin “API” allow you to ping the server (from the ping list) when a post goes live, and not when it is published?
So I can set a future date, and have TXP ping the list when that future date hits?
Or is there currently no event to tap into for that?
Eric
Offline
#2 2006-03-28 03:26:40
- KurtRaschke
- Plugin Author
- Registered: 2004-05-16
- Posts: 275
Re: [request] ping when post "goes live", not when published
I think we covered this a while ago here is no particularly easy way to do this. TXP doesn’t discriminate between “published” articles and “live” articles; instead, the SQL queries are simply written such that future posts are not (by default) shown. There’s no change in the database that occurs when a future-dated article becomes live. From TXP’s point of view, the Status
field in the textpattern
table is always set to 4 (denoting ‘Live’); it’s just the date conditional that keeps the article from being shown.
I would tend to say that the best you could do within TXP would be to send the pings the first time the article is rendered, but that’s not really a perfect solution—if an article goes live on your site at midnight, and you don’t get any hits until 5:00, then pings for that post will be five hours late.
The only other thing thing I can think of would be to keep the post as a draft until it is to go live, then run a script out of cron to publish it at the right moment, but that’s hackish and would depend on external software.
-Kurt
kurt@kurtraschke.com
Offline
Re: [request] ping when post "goes live", not when published
I’ll look into the external script method. Might be an acceptable method.
Would this (rough) logic work?
Script fires every hour (via cron).
Script checks for any drafts that have their “date to publish” between the last check and this one.
“publish” the article (live).
I would check dates since the last run, since I don’t want to publish all drafts… just those ready to go live.
Eric
Offline
Re: [request] ping when post "goes live", not when published
I would think that solution would work out. It’s not the most elegant, but this problem doesn’t really lend its self to an elegant solution.
The one thing is that if you are checking for “date to publish” every hour, and you find one that was in the past hour, I would think that the best way to go about doing things is at that point you can change the article status through the script to live. Keep it in draft until the next time the script runs, and when it runs, it will change the status to live, if that makes any sense.
Offline