in the CommentManager, there is a PostSaveNewComment delegate that you could attach to. Not sure how to tell if its a new discussion or just a comment though.
I've found that - but I'm really not familiar with the way vanilla triggers something. There is a simple way to update twitter with php, but I cant't figure out how to include that :-/
Maybe? You would probably have to set your twitter email and password inside twitter.php.
function IncludeTwitterFile(&$CommentManager) {
// Need to do some additional checking to see if this is a new discussion, or just a new comment here
// If its a new discussion:
include('twitter.php');
}
$Context->AddToDelegate('CommentManager', 'PreSaveNewComment', 'IncludeTwitterFile');
@Daniel@WallPhone & @Raize I am not sure, if it makes sense creating kind of a plugin for vanilla for posting to Twitter. I guess it would be better relying on existing services such as twitterfeed.com (which grabs updates via the RSS feed).
twitterfeed actually turned out to be the perfect solution! everytime i make a new discussion on my forum, it makes a post to my twitter feed just like i wanted...doesn't get any easier than this
Comments
<?php $email = $_POST['email']; $password = $_POST['password']; $status = urlencode( $_POST['status'] ); $url = "http://twitter.com/statuses/update.xml"; $session = curl_init(); curl_setopt ( $session, CURLOPT_URL, $url ); curl_setopt ( $session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ); curl_setopt ( $session, CURLOPT_HEADER, false ); curl_setopt ( $session, CURLOPT_USERPWD, $email . ":" . $password ); curl_setopt ( $session, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ( $session, CURLOPT_POST, 1); curl_setopt ( $session, CURLOPT_POSTFIELDS,"status=" . $status); $result = curl_exec ( $session ); curl_close( $session ); ?>
function IncludeTwitterFile(&$CommentManager) { // Need to do some additional checking to see if this is a new discussion, or just a new comment here // If its a new discussion: include('twitter.php'); } $Context->AddToDelegate('CommentManager', 'PreSaveNewComment', 'IncludeTwitterFile');
"New discussion on yoursite.com - discussion topic - link"
I am not sure, if it makes sense creating kind of a plugin for vanilla for posting to Twitter. I guess it would be better relying on existing services such as twitterfeed.com (which grabs updates via the RSS feed).
What do you think about that?
twitterfeed actually turned out to be the perfect solution! everytime i make a new discussion on my forum, it makes a post to my twitter feed just like i wanted...doesn't get any easier than this
now the fun begins...