Planet Drupal

How to use Views RSS to create a Mailchimp RSS email campaign

Mailchimp provides a great tool for automatically sending out emails that pull information from RSS feeds (read more from Mailchimp on this topic at Create an RSS-Driven Campaign with the Campaign Builder). However, when I first tried out the Mailchimp RSS campaign builder with Drupal's out-of-the-box RSS feed, there were some things that didn't work well. I was using a image field in my blog called 'featured image', and this image was broken in the Mailchimp email, as it was using a relative URL. Also the read more link wasn't working, as it too was using a relative URL. This post will step you through how to set up your Drupal RSS Feed to display the desired information (title, featured image, trimmed body text, read more link), as well as using absolute URLs. It will also tell you how to set up your Mailchimp RSS campaign using the fields you are displaying in your RSS Feed.  

TWO BASIC REQUIREMENTS FOR THIS SETUP

  • Views RSS module - this module provides more granular control of the fields that are displayed in our RSS feed than what is provided out-of-the-box with Views. 
  • Views RSS Media Elements module - if you want to control how images are displayed in your feed, or you have an image that is displayed in an image field (rather than in the body of your node), you'll need this as well. 

​​Step 1: Set up your RSS feed Using Drupal's Views RSS Module

1a. Views RSS: Add the desired fields

Install and enable the Views RSS, Views RSS: Core Elements, and Views RSS: Media (MRSS) Elements modules.

Add a new view (admin/structure/views/add) for your feed. Show Content of whatever type (in this case, Blog Post) you want to include in your feed. Create a page and select the 'Include an RSS feed' option. Click Continue & edit.

drupal views rss initial setup

Click on the Feed display option at the top so you're editing your Feed (rather than the Page), and then under Format click on RSS Feed. 

drupal views rss feed

Select the RSS Feed - Fields option and hit Apply.

drupal views rss feed fields

You'll be presented with a Feed: Style Options window next. Just hit Apply and we'll revisit this once we've added all of our desired fields. 

Now we're going to add our Body, Featured Image, and Path fields that will displayed in our feed. Click on the Add link in the Fields area, and select Content: Body, Content: Featured Image, and Content:Path (use Path rather than Link as it will allow us to use Absolute URLs). Click Apply (all displays). 

drupal views rss feed content

drupal views rss feed image

drupal views rss content path

For the Content: Body field uncheck 'create a label', and under Style settings, uncheck Add default classes (we don't need any added html around our fields). 

drupal views rss remove lable

drupal views rss remove default classes

Also, under Rewrite results, I'm going to trim the body to 500, since we don't want the whole blog post going out in the email. We will return to this field in a moment as well to set up the read more link, but we need to do some additional configuration first. 

drupal views rss rewrite results

For Featured Image, uncheck Create a label, and for the Formatter, select RSS <media:content> element. This is why we installed the Views RSS Media Content module - it gives us the option to format an image field with this tag. Mailchimp RSS email campaigns won't recognize image fields without the <media:content> tag. For image style, select something smallish (for this example, I used Large, 480x480) - one caveat here is that I haven't figured out how to make Mailchimp RSS email campaigns have responsive images. For Medium, select image. I don't think this is required, but I did it to be on the safe side. Click Apply (all displays).  

drupal views rss image format

Lastly for the Content: Path field, uncheck Create a label, under Style settings uncheck 'Add default classes', and under Rewrite results, check Use absolute link. We will need this in the Mailchimp campaign so our Read More link uses an absolute path. Click Apply (all displays).

drupal views rss content path

Now we'll do some quick cleanup to make sure we use absolute URLs. Rearrange the fields so Content: Path comes first. We do this so the Content: Path replacement pattern is available for all of our other fields. Click Apply (all displays).

drupal views rss rearrange fields

To get the Title to link to the absolute path, click on Content: Title, then uncheck 'Link this field to the original piece of content' - the link was broken in Mailchimp since it was a relative link. Instead of this, we will then look under Rewrite results, and select Output this field as a link. Scroll down a little to the Replacement Patterns area, and use the replacement pattern for the Content: Path (it may be different for your setup, so be sure to use what it says on your site for Replacement pattern, don't just copy what I've done here). Then click Apply (all displays).

drupal views rss replacement pattern

drupal views rss rewrite path

We will now add a Read More link to the Body. Click on the Content: Body field, and under Rewrite results, click on 'Add a read-more link if output is trimmed'. We will use the same replacement pattern here that we used above for the title, in this case [path_1], and enter in something nice like 'read more' for More link text. Click Apply (all displays). 

drupal views rss read more link

1b. Views RSS: map fields to RSS elements

Now that we've finally got all of our fields set up, we need to map those fields to the desired RSS elements. We will need this for the Mailchimp RSS template in step 2. Under Format click on the Settings link for RSS-Feed - Fields. We don't need to do anything to the Channel elements. Under Item elements: core, set title to Content: Title, link to Content: Path, and description to Content: Body. 

drupal views rss item elements

For the Item elements : media, set content to Content: Featured image. Then click Apply. 

drupal views rss elements media

Make sure to save your view, and check an <item> in the RSS that is displayed below to make sure that your title and read more links are using absolute URLs. Still with me? Now we're going to use this view to set up the Mailchimp RSS campaign. 

Step 2: Set up your Mailchimp RSS Campaign

Log in to your Mailchimp account, and click on the Create Campaign link, and then select RSS-Driven Campaign.

On the RSS Feed and Send Timing screen, enter in the RSS Feed URL - it should be something like http://mysite.com/feed.xml (you can set this under the Feed settings in the Feed view you just created.) For you to be able to preview what your feed will look like, you will need to do this on a site that is available to Mailchimp, so you can't test something you're doing locally on your machine. You don't need to worry now about when you'll be sending, since we're just testing. Click Next (bottom right of screen). 

On the To which list shall we send? screen use a test group since we'll be doing testing here - don't send to your clients! Click Next.

On the Campaign Info screen, again this is just testing, so you can set it to whatever you'd like. I initially just left almost everything as defaults. Click Next.

On the Change Template screen, pick whatever you'd like, again I just left it all as default initially. Click Next.

We're finally at the place where all of our hard work setting up our feed with Views RSS is finally going to be useful. We're going to use RSS Merge Tags to customize how the content appears for the RSS driven campaign. Check out this Mailchimp article for a full list of RSS Merge Tags.

If you hover over the default text Mailchimp displays, you can then edit by clicking on the pencil icon. 

mailchimp rss email edit default

In this example, we want to display our blog post's title, our featured image, and the trimmed body text with the read more link. We'll tell Mailchimp we're going to do this totally custom, so we'll use the RSS Item tags. The image below is from the Mailchimp Merge Tags article

mailchimp rss email items

We'll open and close the RSS Items tags to start, and then put all of our custom tags in between the RSS Items tags. We want to display our Title, trimmed body (with read more link) and image, so this is what our Text should look like:

mailchimp rss email item custom text

A little explanation - if we read the documentation from Mailchimp in terms of the RSS Merge Tags, we can see the *|RSSITEM:TITLE|* looks for the RSS tag <title>, *|RSSITEM:CONTENT|* looks for the RSS <description> tag, and the *|RSSITEM:IMAGE|* looks for the <media:content> RSS tag (the media:content tag is provided by the Views RSS Media module). If we look at the XML that is output from our Views RSS Feed, we will see the fields we set previously use those exact tags. Yay!

To preview our email, click on the Preview and Test link at the top of the page, and Enter Preview Mode. Hover over your links to make sure they are linking to the correct place and you should see they are since we used absolute links in our Views RSS setup. 

mailchimp rss email preview

You can then modify your feed and Mailchimp template to your heart's content. One gotcha, the Preview option for Mailchimp seems to be cached somehow, so if you change your Views feed, to make sure Mailchimp isn't using some cached version of the feed, change the feed URL in your View, and then update the URL in the RSS Feed setting for your campaign. Kind of annoying, but it's worth it since you will be sure this way to see the updated feed preview. 

 

 

 

 

A Simple Entity Data API for Module Builders

Entity Data is a handy little API to make module builder's lives easier. If you need to build a module that adds functionality and data to an entity, no longer will you have to implement your own CRUD and export/import support.

A module builders dilemma

Fields are a powerful way to add data to Drupal entities. However, sometimes fields can be rather cumbersome. Particularly when you want to add something and thus attach fields to entities that already exists.

The alternative is to roll your own. Just use a hook alter to add UI for your data to the entity edit form using regular form API fields. Then on submit, save the data to a custom table created by the module.

This approach was the primary way of adding functionality to nodes and other entities prior to Drupal 7, before fields were in core. This technique is still utilized quite often in Drupal 7.

Each module that needs to manage entity data without fields has to implement a common pattern for properly storing data:

  • Provide a schema to create a new table to store the custom data.
  • Implement CRUD functions for saving, loading and deleting data, including deleting records when the entity is deleted.
  • Make sure the data exports and imports with the entity

A module builders dream

OK, maybe the header is a bit of hyperbole, but on recent projects were we were having to add data to nodes and various custom entities, Entity Data really made our lives a lot easier.

We created the Entity Data module to centralize the functionality in the common pattern above into a simple to use API.

The primary functions for interacting with Entity Data are:

entity_data_set($entity_type, $entity_id, $name, $value, $revision_id = 0, $language = LANGUAGE_NONE); entity_data_get($entity_type, $entity_id, $name, $default = NULL, $revision_id = 0, $language = LANGUAGE_NONE); entity_data_del($entity_type, $entity_id, $name, $revision_id = 0, $language = LANGUAGE_NONE);

 

They work pretty much the same way as Drupal's handy variable_get, variable_set, and variable_del. Except instead of storing data in a global context, the data is associated with an entity. And rather importantly, data is loaded only when the entity is loaded, not globally like core's variable_* methods.

In addition to using the getter/setter functions, data is auto-loaded and saved with the entity. Any data that has been saved to an entity will be automatically loaded into the entity_data property and can be accessed using:

$entity->entity_data[$name]

 

Additionally any data added to the entity_data property will automatically be saved on entity_insert or entity_update.

This also means that entity_data is automatically exported with the entity and will be maintained on import.

So next time you have to write a module to extend entities, save yourself some time and code by letting Entity Data handle your CRUD.

Have questions or comments about Entity Data? Leave them in the comments below and we'll answer ASAP!

How to display an RSS feed in a Drupal block

If you have a standard RSS feed that you'd like to display in a block on your Drupal website, you've come to the right place. For this example, we will be using a sample feed at http://www.feedforall.com/sample.xml (excerpted here:). 

<item>
    <title>RSS Solutions for Restaurants</title>
    <description>
        <b>FeedForAll </b>helps Restaurant's communicate with customers. Let your customers know the latest specials or events.<br> <br> RSS feed uses include:<br> <i><font color="#FF0000">Daily Specials <br> Entertainment <br> Calendar of Events </i></font>
    </description>
    <link>http://www.feedforall.com/restaurant.htm</link>
    <category domain="www.dmoz.com">
        Computers/Software/Internet/Site Management/Content Management
    </category>
    <comments>http://www.feedforall.com/forum</comments>
    <pubDate>Tue, 19 Oct 2004 11:09:11 -0400</pubDate>
</item>

Let's say we want to display the two of the titles linked to the appropriate URL, along with their description, in a block like this: 

drupal feeds block with views

General Setup

We'll need the following modules:

And here is our general approach. We'll dive into the details next.

  • We will create 2 content types:
    • RSS Feed - we'll use this to tell Feeds about the XML feed we're importing
    • RSS Item - this will be the nodes for displaying the content from the feed
  • We will also create a Feeds Importer - this will tell Feeds what type of data we're importing, where we're importing it to, and how this RSS feed relates to our custom content types. 
  • We will set this up so the site checks for updates to the RSS feeds periodically using cron.
  • Last we'll create a block using views that display the most recent items in this feed. 

Feed Content Types

Why do we need 2 content types you might be thinking? Our RSS Feed content type will be very simple, we will just use it to save the URL of our feed, in this case, http://www.feedforall.com/sample.xml. The RSS Item content type will be used to save the individual items in the feed. In this case, it would contain the title, description, and link from the RSS feed. So go to admin/structure/types/add and create your new content type for your RSS feed. To keep things simple, I turned off authoring information, don't promote to front page, and turned off comments. 

xml feed content type

Next create your RSS Item content type

xml item content type

This one required the addition of fields. These will match the items in the XML feed that you want to pull into each feed item. I just changed the Body field to Description, and added a Link field.

rss item fields

This matches the information in the RSS feed.

<description>
        <b>FeedForAll </b>helps Restaurant's communicate with customers. Let your customers know the latest specials or events.<br> <br> RSS feed uses include:<br> <i><font color="#FF0000">Daily Specials <br> Entertainment <br> Calendar of Events </i></font>
    </description>
    <link>http://www.feedforall.com/restaurant.htm</link>

Set up Feeds module to import

If you haven't already, download the Feeds module and enable Feeds and Feeds Admin UI. 

drupal feeds module

We'll now configure Feeds to import at admin/structure/feeds by clicking on Add Importer, giving our importer a name, and clicking Create.

set up drupal feeds importer

After creating our importer, we'll be presented with a bunch of configuration options. First, under Basic Settings, we will attach our importer to the RSS Feed content type. I've unchecked 'Import on Submission' so we can confirm that this will work when we run cron (select As often as possible for Periodic Import so it will import as soon as you run cron). If you want your Feeds to be imported as soon as you save a new RSS Feed node, you can leave that checked. Save.

drupal feed basic settings

Under Fetcher, we'll select HTTP Fetcher, and you shouldn't need to do any configuration for the HTTP Fetcher Settings. 

Under Parser, if this is a standard RSS feed, you can select Common Syndication Parser, and there won't be any settings for this.

Lastly under Processor, select Node processor, as we will be importing the feed items into our Feed Items content type. Here we will need to do some quick configuration for the Node processor settings. These settings are a little up to you in terms of if you want to update existing nodes, text formats, and the author that will be used as the author of the nodes. The main thing is for the Bundle, you want to select the RSS Item content type. This is telling feeds what nodes to create when importing feed items. For our example, we'll select the RSS Item content type. If there is any HTML in your feed item content (like in the description) select Full HTML as the input format. Save.

 drupal feeds node processor settings

Then click on Mapping under the Node Processor - here is where we'll tell Feeds which fields to populate on our Feed Item content type with the information in the feed. The GUID is the unique identifier for each feed item, and we need to have at least one unique ID. 

Run your first import

Now, if you go to create a new RSS Feed node (node/add/rss-feed) you'll see the Feeds module has add a Feed URL required field. Enter in the URL of the RSS feed and hit Publish. If under your Basis Settings for Feeds you had checked the 'Import on Submission' option, when you saved this RSS Feed node, Feeds would have imported the new RSS Items for you, but since we left this unchecked, saving this node won't do anything except create a new node. 

drupal feeds import feed

Now, when we run cron, we'll see that Feeds will import new nodes.

drupal feeds successful

If we go to the content overview page, we'll see that 9 new RSS Item nodes have been created. 

drupal feeds new imported nodes

Display Feeds Items in Block

Lastly we'll create our block - I'll skip through the details of Views, but basically set up a view block that displays content of type RSS Item:

drupal feeds views block

And then display the title, which I linked to the 'link' field for these RSS item nodes, as well as the description.

drupal feeds set up views block

Display this block on your desired page and this is what you should see:

drupal feeds block with views

Hope this was helpful. Any questions or comments, please leave a note below!

DrupalCon LA 2015 Video: Mediacurrent Interview

In last weeks' DrupalCon interview, we featured Percona. Kyle Taylor, our Drupal Developer, caught up with Nikki and Liz and find out a little about Percona and what they do with MySQL. If you missed the interview with the Percona, Drupal AssociationLullabotPantheon, or even our first Roundtable Interview, you can catch the interviews by clicking on the links. The interviews first appeared during our week long live broadcast with Periscope and Twitter.

In our latest video interview, we feature the Mediacurrent. Kyle Taylor, our Drupal Developer, caught up with  Mark Casias and find out a little about Mediacurrent and what they do with Drupal. 

Mediacurrent INTERVIEW

Note: The video is available in 1080p HD format.

WOULD YOU RATHER READ THE INTERVIEW? READ IT HERE:

[Kyle]: Kyle, with LevelTen in Dallas, Texas. We're here talking with Mark at Mediacurrent. Mark [Casias], tell us what you guys do and interesting Drupal and etc.…

[Mark]: So we are actually a full staff Drupal shop. We work with many clients. We actually did Weather.com and the NFL Project. We do marketing, we do client integration, we do development, we do pretty much the full stack. I actually run the podcast, the Mediacurrent Dropcast. We're doing a Birds of a feather on Thursday, if you guys wanna come participate, it'll be a lot of fun or it will be what we normally do.

[Kyle]: Alright. So, what kind of projects do you guys working on or what are some of the things you are building with Drupal?

[Mark]: So, we've gotta couple of projects that we're working on with the Drupal 8, we're actually starting to do development in Drupal 8. We do a lot of contributing work for the community as well. We are actually required to give back to the community as well. We're working on various educational systems, we did Weather.com, that is actually in a process of wrapping down but it's still on Drupal and we've done a lot of other contributing back to the community because of it. It's been a lot of fun work.

[Kyle]: Cool! What do you think the importance of contributing back is, in terms of being in an open source community and a developer, kind of, evangelizing the community? What is the importance of contributing back to the project?

[Mark]: It moves the project forward, which moves us forward professionally, in my opinion. If we just kinda sat there and let the project scale ourselves, they wouldn't really get anything done for us in the long run, or we would be reinventing the wheel over and over again. Where we have somebody else that's working on a much better module over there, we can incorporate that, give back to them, improve that for them and ourselves as well. I think that's a main difference between our community and every other community, because we are such a do-ocracy that we want everybody to get in there and get their elbows greased up and whatnot.

[Kyle]: Yeah! So, Drupal 8, what do you think about it so far and what is the most exiting feature you are looking forward to?

[Mark]: My favorite part about Drupal 8, is one, that it is a full OOP project now. You are no longer developing with procedural code, which gets really stringy, really ugly, really quick. Then the fact that we're doing, we're getting configuration management out of the database and actually into code, which makes moving things from one area to another very very easy, which will make my life a ton easier.

[Kyle]: Ok, so, we're going to hear more about Mediacurrent and read more about you guys.

[Mark]: So, Mediacurrent.com is our website and we're always around there and we have our own blog and the drop cast if you get that on iTunes, Mediacurrent Dropcast.

[Kyle]: Awesome! Thanks so much, Mark, appreciate it.

[Mark]: Thanks for having me.

[Kyle]: Thank you.

Want to listen to all of our interviews? Subscribe to our iFX Podcast on iTunes!

Drupal 8: Marketer Friendly

The digital marketing world keeps changing, basically every day, or whenever Google decides it’s time to change their algorithm. As a person who practices digital marketing, I know the challenges of working with a CMS and the need to for it to allow me to publish blog posts (like this one) easily and have it be mobile responsive, because who uses actual computers these days?

Content marketing isn’t a fad, it’s happening, right now. I’ll be honest and say sometimes working with Drupal makes it challenging when adding content. However, working with Open Enterprise, a Drupal distribution makes it a lot less complicated, especially for someone who is not technically inclined and has limited coding experience.

That being said, the announcement of Drupal 8’s features and what it has to offer seems like Drupal is making a conscious effort to make it easier on the everyday marketer. 

According to the Drupal.org website:

Drupal 8 allows marketers to:

  • Use the marketing software you already know.
  • Build campaigns with mobile in mind.
  • Add, remove or revise content simply.
  • Easily deliver content segmented by audience, language and device type.

Out of the many features Drupal 8 offers, my favorites would have to be the improved WYSIWYG that now comes inline images and responsive images. As well as the admin menu, which I'll get into later.

It's great to know how small or large you can make the image and the options of making them align. I should note that Open Enterprise CMS already has this feature built into the WYSIWYG. It's really great that it is now going to be a standard feature in Drupal 8. Open Enterprise CMS' image upload and size configuration looks like this:

Image Source: getCMS 

Responsive images in the WYSIWYG also make the content marketer see how their images will be seen on mobile. From the example given by Acquia, see picture below, it looks like images can be tested for responsiveness by "resizing the browser" (which we affectionately call 'twerking').

Image Source: Acquia

A feature in Drupal 8 that might not be something you think about is the look of the admin menu (see admin menu above). You're probably wondering why I like the admin bar, well, I also work with WordPress CMS. So, if you have clients that are looking to move from WordPress to Drupal sometime in the future, this nav bar will help with the learning curve of finding menu items. It looks very similar to WordPress' admin "dashboard" menu. [Note: I've been creating content on Drupal 7 sites for over a year, so I have no problem with admin menu now, but it was confusing at the beginning. There was something about the menu being on the top of the page rather than the side that threw me off. Before working on Drupal CMS, I exclusively worked on WordPress sites.]

What are some of the new elements you all are looking forward to when Drupal 8 releases? Let me know in the comments!

DrupalCon LA 2015 Video: Drupal Association Interview

Last week’s DrupalCon interview featured one of Lullabot's Technical Project Manager and Front-End Developer. If you missed the interview Lullabot, Pantheon, or even our first Roundtable Interview, you can catch the interviews here. The interviews first appeared during our week long live broadcast with Periscope and Twitter.

In our latest video interview, we feature the Drupal Association. Kyle Taylor, our Drupal Developer, caught up with Joe Saylor, CMO of the Drupal Association. In the video, Saylor talks about what the Drupal Association does for Drupal and DrupalCon.

Drupal Association INTERVIEW

Note: The video is available in 1080p HD format.

Would you rather read the interview? Read it here:

[Kyle]: So this is Kyle with LevelTen Interactive and we are talking with the Drupal Association. And I'm gonna let Joe introduce himself so, Joe. Tell us a little about yourself.

[Joe]: I'm Joe Saylor and I'm CMO of the Drupal Association.

[Kyle]:  Alright what do you guys do?

[Joe]: The Drupal Association is the kind of the legal entity behind the Drupal Project. We, our mission, is to help the Drupal Project flourish. So we provide funding for Drupal projects, we put on DrupalCon events. Both in North America and in Europe. We've also been a third kind of rotating Con what we're calling emerging markets. So we did one in Latin America last year, next year we'll be doing on in India.

[Kyle]: How many DrupalCons do you guys do a year?

[Joe]: 3 total, so one in North American, one in Europe, and then one in some emerging market.

[Kyle]: So what are some of the projects you guys backed? By the Drupal Association.

[Joe]: The types of projects that we grant, right now, we're actually really focused on Drupal 8, we have a program called Drupal 8 Accelerate. We've matched $125,00 so anybody that matches that, kicks in against that trying to raise a total of $250,000 the types of projects that get funded are really sprints. So that coders are actually getting into a room together working on the code, squashing the critical bugs. Last I heard, we're down to 27 criticals for Drupal 8. So as Dries [Buytaert] mentioned, in the Keynote this morning, fingers crossed for a Barcelona timeframe release. But it's done when it's done.

[Kyle]: So as far as the community getting involved; so like if your a developer by yourself, how do you get involved with the Drupal Association?

[Joe]: Well with the Drupal Association you can become a member, that's a great way to start. And if you want to contribute directly to Drupal you can actually look up the mentorship program on Drupal.org that's a way for first timers to get in and whether you want to code you can do that, you can write patches. Whether you want to contribute in some other way if you're not a coder, you can do that. You can do things like marketing, there's all sorts of ways to get involved. Whether you're technical or not.

[Kyle]: Cool, so where can we hear about the Drupal Association?

[Joe]: You can hear more about the Drupal Association at assoc.drupal.org. If you just go to Google and type in Drupal Association it's probably an easier way to get to it. But on the site theres some videos that explain what we do. Various pages, you can become a member there. It also likes directly to drupal.org which the home of the community and you can learn lots more about Drupal and community there.

[Kyle]: Alright awesome thanks Joe.

[Joe]: You're welcome.

Want to listen to all of our interviews? Subscribe to our iFX Podcast on iTunes!

DrupalCon LA 2015 Video: Lullabot Interview

Last week’s DrupalCon interview featured friends from Pantheon. If you missed the interview or even our first Roundtable Interview, you can catch the first episode here. The interviews first appeared during our weeklong live broadcast with Periscope and Twitter.

In our latest video interview, we feature Drupal agency Lullabot. Kyle Taylor, our Drupal Developer, caught up with Lullabot’s Technical Project Manager, Darren Petersen and Front-end Developer John Hannah. They share what they do on a general day, what Lullabot does, their opinion on Drupal 8, and working with Drupal.

 

Lullabot Interview

Note: The video is available in 1080p HD format.

Don't have time to watch? Listen to ALL of the interviews on our Podcast: iFX Podcast!

Want to hear more podcasts? Perhaps more interviews on Drupal? Let me know in the comments!

About Lullabot

Lullabot, a U.S.-based company, with contributions to the Drupal project include: the URL aliasing system, the ecommerce package, sIFR, TinyMCE, and countless bug fixes and features, plus extensive documentation, videocasts, and the weekly Drupal podcast. 

Content Migration From One Drupal 7 Site to Another

I have first hand experience dealing with content migration, and let me tell you, it can be frustrating sometimes. If you're tired already and you're looking for ways to migrate content between Drupal 7 sites, then you are in the right place. I'm going to walk you through the steps that I had to do in order to get 500+ nodes seamlessly migrated from one Drupal site to another.

Before I start I would like indicate that I have tried using different ways, but with no luck! I tried using Node Export module and I also tried using Deploy module, but I guess the sites I've been working on were too complex or too unstable for them to function as expected. For example, the deploy module kept breaking the site whenever I attempt to fetch content, while node_export was failing silently, I submit the import form and it just reloads without doing anything at all, no errors, nothing.. Very frustrating.

So eventually I did it with XML Syndication. Here's how.

Overview

XML Syndication is the concept of having Site A's content, available through HTTP as an XML feed so that Site B can fetch, parse, and import the content. Just like an RSS feed, but more customized.

This method allows for importing one content type at a time, and it supports most field types.

Module Dependencies

Site A Steps

  1. Create a new Feature and include the content type to be migrated, along with all its field definitions; in order to replicate them on Site B.
  2. Create a new view. Add a Page display and set a path for it. Using the  Views Datasource plugin set the FORMAT to "XML data document". In the FORMAT settings, make sure to set a meaningful name for the "Top-level child element" because we're going to need it later. Don't use a pager and set the view to display all nodes.
  3. Test your view page, and make sure it displays a valid XML document that lists all the nodes to be migrated correctly.

Site B Steps

  1. Copy the Feature that you have just exported from Site A to Site B's sites/all/modules folder, and enable the feature. This should replicate the content type and all its fields.
  2. Go to /admin/structure/feeds and add a new Feed Importer. In the Basic settings of it, set "attach to content type" to use a standalone form, and check the box that says " Import on submission".
  3. Set the Fetcher to HTTP fetcher, and set the Parser to XPath XML parser.
  4. Set the Processor to Node processor, and then click on its corresponding Settings. Set the "Bundle" to the content type that was created by the Feature earlier. Set the desired Author, and disable the "Expire nodes" option. You can also choose how you want to treat existing nodes, but note that this will require you to choose a "Unique Field" in the next step.
  5. Click on the Node processor - Mapping link, and add all the content type fields as targets and set their source to "XPath Expression". Choose the field that should be unique if needed.
  6. Make sure the fields in the Node processor match the XML document fields created in SITE A STEP 3
  7. Click on the Parser settings and set the XPath expressions so that the expression in each field points to the corresponding field in the XML document. Here is an example of XPath Expressions format. In the example, the context //r  refers to the "Top-level child element" we talked about in SITE A STEP 2.
  8. Once you're done. Save your importer and go to /import. Click on the name of the importer that you have just created.
  9. Type in the URL of the XML document created in Site A.  And now you are ready to import content!!

Good Luck!! 

Have questions? Leave them in the comments below!

DrupalCon LA 2015 Video: Pantheon Interview

On Wednesday’s blog post, we debuted our first interview from DrupalCon. If you missed the Roundtable Interview, you can catch the first episode here. The interviews first appeared during our weeklong live broadcast with Periscope and Twitter.

Our latest interview features Pantheon. We are proud partners of Pantheon, which is where our Drupal Distribution, Open Enterprise, is hosted. Kyle Taylor, our Drupal Developer, meandered through the exhibit hall and gathered some interviews from our friends at Pantheon. They share their opinion on hosting Drupal 8, and working with Drupal.

Pantheon Interview

Note: The video is available in 1080p HD format.

Don't have time to watch? Listen to ALL of the interviews on our Podcast: iFX Podcast!

Want to hear more podcasts? Perhaps more interviews on Drupal? Let me know in the comments!

DrupalCon LA 2015: Roundtable Interviews

A few weeks ago, the team was in Los Angeles for DrupalCon 2015. Our very own Kyle Taylor took his iPad and mic and interviewed developers, freelancers, and some of the top Drupal Agencies that attend the week long event. 

We previously wrote a blog about Periscope: Social Media: Using Periscope at Events. Well we followed our tips and used it to video interviews. If you were not able to join our live feed from DrupalCon, we downloaded the interviews for everyone to watch them again!

Roundtable Interviews

Kyle interviewed a group of Drupalers in this video. They share their opinon on Drupal 8 and working with Drupal.

Note: The video is available in 1080p HD format.

Liked watching interviews like this one? Stay tuned for the rest of the interviews conducted throughout the week during DrupalCon!

​Don't have time to watch? Listen to ALL of the interviews on our Podcast! iFX Podcast