D7: Map blog feeds to Organic Groups (OG)

Standard

In a previous post, I proposed the idea that asking questions on stackexchange and stackoverflow is a good idea for Faking It Till You Make It (FITYMI).  The flip side of that is, of course, answering questions.  Since I recently answered a Drupal 7 question on  Stack Overflow, I thought I’d share it here.

FITYMI tip: Answer questions on stackoverflow and stackexchange

 

Question:

(I’m paraphrasing here) How do you map Feeds to Organic Groups? Say you have Organic Groups (OG) on your Drupal 7 site, and you want to give each of them their own blog(s).  Feeds is great, but it doesn’t allow you to map a reference group (patch time!).

Answer:

What you do, essentially, is assign all incoming feeds a default value, and then match that value to the one you put in your content type.  Having the same field and field value shared among the feed, the content type, and the OG links them together, and makes it possible for you to relate them in Views, etc.  I’ll admit this method is a little bit scrappy (as in, not exactly a hack, but not super elegant), but it definitely works!**

The Details:

1. Install both Feeds and Feeds Tamper.
2. Create a content type to receive the feed entries.
*I’ll call this new content type “Blog post”
3. Add a text field to BOTH the new content type AND to your OG form.
*I’ll call this field “Feed nickname”
4. Fill in the field with the appropriate feed nickname on your OG form.
*I suggest making this a one-word nickname
5. Under Structure>Feeds Importers>Edit>Node processor settings, select “Blog post” as the chosen bundle to receive the feed. Click save.
6. Under Structure>Feeds Importers>Edit>Node processor mapping, add a new mapping with “Blank source” as the source and “Feed nickname” as the target. Click save.
7. Under Structure>Feeds Importers>Tamper, scroll to the section “Blank source-> Feed nickname” and click “add plugin.”
8. Choose the plugin called “Set default value” and set the default value to your chosen feed nickname. Click save and make sure the plugin is enabled. Click save at the bottom of the tamper form.
9. Add the feed importer as usual, under yoursite.org/import

Whew, that was long-winded.  Buuut, I hope it helps someone!  It took me hours (multiple of them! and many cups of coffee!).  Hopefully it will only take you 1 (or less! yay!).

**Notes: I’m assuming you’re working with a Drupal 7 site.  I’m assuming you do know how to use Feeds, but that the OG component is what’s confusing you.  (For basic instructions on installing and using Feeds, try LevelUpTuts. They have a good series of videos on Feeds of all kinds.) I’m assuming that you don’t want to do any coding.  I’m assuming that you’re importing an RSS feed (though it should play well with other types of feeds, too).  Also, I haven’t tried it, but I’m assuming this process would work for assigning blogs to individual users, too.  You’d just put the Feed nickname field on the user form.  Let me know if you try it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s