In my last post I outlined a bit of what our vision is for syndicating all of the work happening in disaggregate spaces through Domain of One's Own. When you use Wordpress Multisite it's pretty easy to get a unified feed of all the work that is happening since everything is in your database and can be called pretty easily alongside approaches like Sitewide Tags. With our new setup on UMW Domains each individual has their own self-hosted Wordpress install in their own space. In fact many have 2-3 installs in a variety of subdomains, and it's not even guaranteed that they're using Wordpress (although the majority do). So how can we syndicate all that work into a central hub that could allow us to parse that data by a variety of factors like course, category/tag, content type, etc? I spent the last two days hacking away at this and I've got the first step to a solution. The two tools we're using are Installatron and FeedWordpress. Installatron is a plugin that runs on our hosting software, Plesk (but we'll be switching to cPanel this year and Installatron supports that as well), and provides an extremely user-friendly interface for installing web software. No FTP uploads or setting up databases, in most cases it's one-click, enter a few settings, done. While there's no way to know for sure without writing a fancy script, I'd estimate the vast majority (maybe even all) of the installs of Wordpress are done using this tool. And of course FeedWordpress is always playing a star role in our syndication efforts. It pulls in any number of feeds along with all their categories/tags (as well as any predefined by you) and creates a local post that points back to the source. For setting up a unified "mother blog" that can then have RSS feeds based on any category or tag it's still the best thing going. What I didn't know when outlining my ideas a few days ago was that Installatron had some really fancy ways of writing scripts that would initiate at various points during the install or upgrade process of piece of software. You can get as granular as writing a script that only runs for a specific version of a specific piece of software and choose where in the process of install it gets run. Once I found out from them that connecting to an external database via PDO would work, I knew I could build the glue that would insert information from that install into our feed website's database in a format that FeedWordpress would use to parse it. Information on customizing Installatron can be found here and I have to say their support is FANTASTIC with ticket responses sometimes coming within minutes of asking the question. Below is the code I ended up using:
class iinstallercustomcode
{
function init()
{
$this->registerCustomCode("wordpress", "all", "install", "last", "process", "wordpressinstall");
}
function wordpressinstall($o)
{
$db = new PDO('mysql:host=localhost;dbname=wordpress_f1', 'wordpress_08', '2jWz_3tP6E');
$siteurl = $o->install->ini["url"];
$feedurl = $siteurl . '/feed/';
$linkinsert = "INSERT INTO `wp_links` (`link_id`, `link_url`, `link_name`, `link_image`, `link_target`, `link_description`, `link_visible`, `link_owner`, `link_rating`, `link_updated`, `link_rel`, `link_notes`, `link_rss`) VALUES
(null, '$siteurl', '$siteurl', '', '', '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '', '$feedurl')";
$db->query($linkinsert);
$linkid = $db->lastInsertId();
$setcat = "INSERT INTO `wp_term_relationships` (`object_id`, `term_taxonomy_id`, `term_order`) VALUES
($linkid, 3, 0)";
$db->query($setcat);
}
}
?>
So basically what is happening there is a function is initialized that will run on all versions of Wordpress that get installed. The function sets up a connection to our mother blog's database where we want to do the feeding. We grab the URL from the install and write it to a variable as well as format an RSS URL by tacking /feed/ to the end of the URL. Then we format the SQL query to add a new link to the wplinks table which FeedWordpress uses as the source of what gets syndicated. FeedWordpress has to have the link be assigned a specific category which unfortunately is setup in the wpterm_relationships table so after putting our link in we have to grab the unique ID of the link of format a new query that adds a term relationship between that link id and the assigned category (in this case category 3 which is "Contributor") and fire off that query. The result is that any new Wordpress install now automatically gets added to FeedWordpress on our feed website here and begins syndicating automatically. This in and of itself is pretty awesome. It means any course using UMW Domains could now ask their students to use a specific tag and then grab a feed of that tag from the mother blog. The students don't have to add their sites to any main website or do anything else other than the simple act of installing Wordpress. But we can go further by allowing students to set certain categories during the install process. With Installatron we can setup custom input fields in the install page that will ask for specific information. In this case we could have a list of checkboxes and ask the student/faculty member to "check all that apply" and have them categorize that install by whether their a student, faculty member, what discipline they're in, etc. All those checkboxes can be associated with categories that get inserted into the SQL query that adds the link so FeedWordpress will automatically assign those categories to the feed in addition to any categories the user sets on their individual posts. I could give the History departement a feed of all the work their student's are doing on UMW Domains as a feed that they could pull into their department website to highlight that work. This isn't limited to Wordpress either. We have the framework in place now where I can go through some of the other install processes like Drupal and setup the same link insertion. The only variable that changes is the format of the RSS URL which is easy enough to find. There are tons of possibilities and I'm only covering the low hanging fruit here that we've been talking about for years and doing on UMW Blogs but can now do across the beautiful but disaggregated spaces that UMW Domains provides. It's a small single-run batch of eduglu that's starting to smell pretty potent.