I'm working on Orchard CMS and I need to have a couple of blogs. Each blog needs to ha开发者_开发技巧ve a Twitter account and a Facebook page associated. Whenever a new tweet or a new status is posted on those Twitter/Facebook accounts I should somehow read that tweet/status and create a new blog post automatically. So basically when somebody reads the blog he should see the tweets and the status updates aggregated with the other blog posts.
What is the best way to do this? Also what's the easiest way to associate the Twitter/Facebook accounts to the blog - should I extend the Blog module and add the new fields?
Thanks!
The best option would be to write your own module with some part holding the Twitter/Facebook account data and attach that to existing Blog content type. It wouldn't involve alteration of the core bits. Clean and nice solution.
Second thing would be to find a way to periodically retrieve and keep track of the recent FB/Twitter posts/tweets. Orchard has a built-in and extendible feature for background task scheduling. Basically, all you need is to create an implementation of Orchard.Tasks.IBackgroundTask and put all logic inside Sweep method - that one will be called periodically.
Third thing would be to write the code for talking to FB/Twitter. I'd recommend you use Facebook C# SDK for FB and Linq2Twitter for Twitter communication. Used both inside Orchard - they work very well and are rather straightforward to use. Take a look inside Nick Mayne's OAuth module. There is some code inside that utilizes those libs - that could be helpful.
HTH
精彩评论