Perfecting the Syndicated Blog Sign-Up

It’s hard to believe that Camp Magic MacGuffin finished weeks ago, and in another five days (yikes!), a new session of ds106 starts up here at UMW.

Alan and I ended up really tearing our hair out for the first few weeks of CMM trying to get everyone signed up with their blogs in FeedWordPress and tagged appropriately (in the CMM case, tags were used primarily for the bunk houses students were assigned to).

Going into the fall semester, I really wanted to clean-up this process. 

To review, here’s how things more-or-less have worked in the past:

  1. New DS106 participant/student goes to and clicks the “Register” link. This takes them to a form that they fill out with information about who they are, what user id they want, what password they want, their institutional affiliation, and the URL of their blog.
  2. Using BuddyPress, when they submit the form, a user account is automatically created for them.
  3. One of the ds106 admins (Alan, Jim, or me) then goes and hunts down their new User Profile and copies and pastes their blog URL into FWP.
  4. We then try to discover the feed in FeedWordPress.
  5. Then we have to assign the appropriate tag to the feed (so that incoming posts have a tag added to them that we can use to organize content)
  6. And, finally, we have to ensure that posts from that feed are assigned to the new user account. This last step is the trickiest for me. FeedWordPress allows you to create author maps for posts in a feed, but we have so many users in ds106 that the list is kind of crazy to work with — especially if you’re not sure how the user’s name is displayed in the list. And, if the feed has already been updated at least once, a new user has already been created and assigned to the feed’s posts. Cleaning this up is a BIG headache.

Invariably, I always screw pieces of this process up (Jim and Alan are better at it 🙂  ) So, really, the work I’ve been doing for the last couple of weeks on this has been mostly to make my life easier!

Here’s how the new system works:

First, it requires a Premium plugin, Gravity Forms, which we use extensively at UMW. I cannot sing this plugin’s praises enough! Not only is it a robust form creator, in and of itself, it’s got some slick add-ons and tons of hooks and filters to do custom development on top of it. I love me some GF! There are a couple of “levels” for purchasing, but I think it’s well worth the money, especially for an institution.

Second, we’re using one of those slick add-ons for GF which allows a form to be used to create user accounts. (The add-on is free).

Now, we do user registration currently on ds106 using BuddyPress. And I have no doubt that someone could probably do what I’ve done using that registration system, instead. But I’m NOT a BuddyPress expert, and I do have a bit of experience with Gravity Forms. So, I chose the poison I knew.

The new user registration consists of two forms:

  1. Form #1: This is the basic user registration form. You choose a userid & password. Then you provide your name, email, institutional affiliation, blog address, and Twitter handle. As soon as this form is submitted a new user is created, using this information. In addition, I incorporated a custom function that Alan wrote to discover RSS feeds associated with the blog url.When the form is submitted, a custom function is called that runs Alan’s code. Currently, we’re grabbing just the first RSS feed discovered. This is then passed as a variable, along with the userid and institutional affiliation, to the second form.A note about the institutional affiliation: When you fill out the form, you’re presented with a set of radio buttons for this field. Each button corresponds to a different course/institution on which we might want to filter incoming posts. Gravity Forms makes it really easy to associate those listed affiliations with a value. That value will ultimately become the tag that is assigned to the blog’s feed. So, for example, if you fill out the form and choose “University of Mary Washington: Fall 2012 (Burtis)” as your affiliation, what actually gets passed as a value is “umwfa12s1,” which is the tag we’ll be using for posts written by my students this fall.
  2. Form #2: This form consists of two hidden fields which contain the username and affiliation tag (passed from Form #1). A third field is a text box that is dynamically populated with the value of the RSS url (also passed as a variable to this form).Users can simply click “Submit” to accept the discovered feed address. Or, if they want to get fancy, they can put in another feed address (particularly useful if they’re using a category/tag on their blog and want to only feed those posts).When a user clicks “Submit” another custom function is run that adds the RSS URL to the blogs Link list. FWP actually uses a category from WP’s native Links feature to dynamically generate the list of feeds that it checks. The default category it uses is “Contributors,” but you can change this in the FWP settings.In addition, FWP uses the built-in “Link Notes” property of each Link to track information about each feed. In some ways it’s kind of slick how FWP builds upon the already existing Link type; in other ways it’s a bit kludgy. The Link_Notes is just a text string that FWP breaks apart in order to discover all of the settings for a feed. It was pretty tricky for me to figure out how to manually build the string that assigns authors and tags to a feed. Basically, FWP looks for linebreak characters escaped with C-style backslashes to break apart the Link Notes string, and, as it turns out, the built-in WP function to add links strips these slashes out. I had to address this on two fronts: First, I had to remove KSES filters when new links are added. Second, I had to actually edit a core file to take out the function that removes the slashes. Obviously, this is a big no-no. So, I’m looking for better solutions. Anyone got one?!

    For the meantime, though, here’s what the submit link function basically does:

    • Translates the username (in the first hidden field on the form) into the corresponding user ID.
    • Builds a string based on the format that FeedWordPress uses for assigning authors and tags to feeds. The user ID is used to assign the author. The institutional affiliation tag is used to assign the tag.
  3. Creates a link in the “Contributors” category with the contents of that string in “Link Notes.” The RSS url is assigned as both the main link url and the associated RSS url (All Links in WP can have an RSS URL associated with them, and this is what FWP uses to syndicate posts).

The whole thing is packaged as a plugin so that if/when we change themes on DS106, it should continue to work.

If anyone wants to take a look at the code here it is. But, because this is programmed to work with ds106 specifically, if you try a similar technique on your site, you will have to edit it to correspond to your form fields, etc.

So, that’s it. What needs to be changed/fixed/improved?