Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-07-03 11:30:11

frangarcia
Member
From: Elche
Registered: 2005-11-14
Posts: 13
Website

Make something after public a post

I was wondering how to do this to develop a plugin for textpattern. How can I do something after someone publish a post into textpattern? For instance, when I public a post, send a message to some people.

Can anybody help me?

Thanks in advance


What doesn’t kill you, makes you stronger

Offline

#2 2007-07-03 12:19:39

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Make something after public a post

Starting with release 4.0.5, Textpattern calls eventhandlers for the “ping” event after an article is published (here). You could hook that event and add your own code into it. Look for register_callback() here to get a starting point.

Offline

#3 2007-07-03 13:57:00

frangarcia
Member
From: Elche
Registered: 2005-11-14
Posts: 13
Website

Re: Make something after public a post

That was just what I was looking for, but now I have some problem. Once the user has posted something, I want to retrieve the ID of the new post, but I don’t know how to get it. So that’s what I’m doing:

register_callback(“my_function”, ‘article’ , ‘create’);

function my_function($event, $step){ //Here I want to do something, but I need the ID of the new post created.
}

Has anybody any idea how to do this?


What doesn’t kill you, makes you stronger

Offline

#4 2007-07-03 16:11:38

frangarcia
Member
From: Elche
Registered: 2005-11-14
Posts: 13
Website

Re: Make something after public a post

Thanks guys for your help. I’ve already finished a plugin called txp_twitter. Everytime you create or edit a post, a messages is sent to twitter. You can see more information at http://textpattern.org/plugins/804/txp_twitter

I wait for your suggestions!


What doesn’t kill you, makes you stronger

Offline

Board footer

Powered by FluxBB