Page 1 of 1
Tweetback-Plugin for s9y?
Posted: Mon Mar 02, 2009 9:59 am
by oliverg
Well,
the subject says it, is there any possibility to show Tweetbacks in S9Y? Could not find anything...
This would show if there are any referrers from twitter to a Blogpost.
Oliver
Re: Tweetback-Plugin for s9y?
Posted: Mon Mar 16, 2009 5:37 pm
by mattsches
Hi Oliver,
I might take a look at this because I would like a feature like this as well, but I cannot promise anything
Regards,
- Mattsches
Re: Tweetback-Plugin for s9y?
Posted: Tue Mar 17, 2009 10:40 pm
by mattsches
Ok, I started to think about it more seriously. I managed to fetch tweets from the public timeline and stuff, but now I wonder how to store them.
Looks like my plugin could define a new comment type - e.g. "TWITTER" - and insert the respective tweets into the comments table. Those can be selected with serendipity_fetchComments(), but which would be the right event hook to fetch them?
Obviously it isn't "fetchcomments" because that throws an error. "frontend_display"? But what if I want to merge the twitter comments with regular comments (ordered by timestamp)? Is this possible?
Any ideas appreciated!
- Mattsches
Re: Tweetback-Plugin for s9y?
Posted: Wed Mar 18, 2009 10:35 am
by garvinhicking
Hi!
This is currently not really doable without a core or template patch.
Since templates only have room for comments and trackbacks, you need to insert your pingbacks at one of these locations. I'd probably suggest to output tweetbacks in the trackbacks section.
For that, the smarty function {serendipity_printTrackbacks entry=$entry.id} is called in all entries.tpl templates. This relates to include/functions_smarty.inc.php, the serendipity_smarty_printTrackbacks() function. That one calls the serendipity_fetchTrackbacks(), and there no plugin API hooks are called. PINGBACK and TRACKBACK are hardcoded there.
So a plugin api hook would needed to be added there. Or, of course, one could create a plugin with a custom smarty function that would be called inside the template, then you could have your own independant tweetback section.
The easier alternative could be to merge tweetbacks with comments. There you could hook into "fetchcomments" and merge the data structure with all existing tweetbacks. $eventData in this event hook should hold an array of all comments; you could use array_merge or something like that to append that data structure.
Regards,
Garvin
Re: Tweetback-Plugin for s9y?
Posted: Wed Mar 18, 2009 11:39 am
by mattsches
garvinhicking wrote:The easier alternative could be to merge tweetbacks with comments. There you could hook into "fetchcomments" and merge the data structure with all existing tweetbacks. $eventData in this event hook should hold an array of all comments; you could use array_merge or something like that to append that data structure.
Garvin, I had the same idea just an hour ago

Sometimes, the simplest solutions are the best. I implemented it with array_merge(), and it works as expected. Now I only have to put it all together, thanks.
- Mattsches
Re: Tweetback-Plugin for s9y?
Posted: Wed Mar 18, 2009 10:32 pm
by oliverg
Now I'll be moptivated to droppp off my ideas more often in this place
I'm looking forward to the thingy being finished
