WELCOME TO THE BLOG

Facebook Comments and What's Next

This past Wednesday we released a pretty major update for free to all ProPhoto4 usersbuilt in Facebook comments integration.

an example of integrated Facebook comments on a blog post

Brought to you by Automatic Updates

I’m pretty excited about this most recent update, because it was made possible by one of the great new features of ProPhoto4: automatic updating. Before P4, we rarely were able to add new features to ProPhoto between major paid upgrades, because the complexity and time required to get everyone to manually update their theme files was too great. Now, with P4, about 96% of our users get updates automatically with zero work on their part — ProPhoto just updates itself to a new build whenever there is a new one available.

Since P4 was launched in late September, we’ve already used automatic updating to push a number of new features, enhancements to existing features, and a slew of minor bug fixes. Facebook comments is simply the latest and largest example of these free updates. Being able to continually release improvements to ProPhoto through automatic updating is exciting to us because it means ProPhoto will be able to evolve faster and stay more current between major versions, and allow us to react quicker to changing trends in web world in general. We think it makes ProPhoto a better product, and will help your websites stay fresh, current, and competitive.

More on Facebook comments

I had originally intended to write up a bunch of details about how the new Facebook comments feature works, but we ended up creating a very detailed tutorial for the new feature that covers almost everything I wanted to mention here in the blog. So, if you’re looking for tons of screenshots and a detailed explanation of how the new feature works, how to enable it, and what exactly the different options do, head over to the new tutorial.

Handling old posts and non Facebook comments

One of the toughest things about integrating Facebook comments was figuring out what do for people who wanted to use Facebook comments, but had many months or years of old posts with comments that they did not want to lose or stop displaying. Facebook comments actually are sort of an optical illusion — they look like they’re on your site, but you’re really seeing through in invisible window (called an iframe) into an actual Facebook.com page. So, for obvious reasons, there’s no way to take old comments from a WordPress blog and “push” them into Facebook’s system.

Because we couldn’t move old comments onto Facebook, we had to somehow deal with the old posts with the old comments. At first we considered letting you set a cut-off date before which we would show WordPress comments, and after which only Facebook comments would be seen. But this was problematic for a number of reasons, and we eventually rejected it. What we ended up deciding on was not a time-based approach, but rather an approach that lets you make customization choices that fundamentally answer two basic questions:

  1. What do you want to do with comments that exist outside of Facebook? Show them or hide them?
  2. How do you want to accept new comments when Facebook comments are enabled? Through Facebook only or through Facebook and also through WordPress?

Answering these questions is pretty intuitive, and leads to some fairly intelligent configurations. You can completely hide all non-Facebook comments if you want and start over with a clean slate, or you can show both types of comments. If you are only accepting new comments through Facebook, you can still show old WordPress comments on old posts. New posts without any old WordPress comments will seem as though you only are using Facebook comments, while visitors to your old posts will still be able to see old comments left before you started using Facebook comments. If you have more questions about this, see the tutorial linked above.

Pulling comments FROM Facebook

I mentioned in the previous section that Facebook comments actually exist on Facebook’s site, so you can’t “push” comments into Facebook. But we can “pull” comments left on Facebook and store them in your WordPress site database. We built our new Facebook comments integration to automatically pull all comments left on Facebook into your database, inserting them as if they were regular WordPress comments left through your traditional add a comment form. We did this for several reasons:

  • It allows us to display those comments as traditional WordPress comments should you ever decide to stop using Facebook comments
  • It allows us to print Facebook comments to the page source code in such a way that they are not visible to the reader, but can be read and indexed by Google (since Google won’t look inside the iframe to see the actual Facebook comments themselves)
  • It allows us to preserve your comments if you change your blog address or permalink structure

That last point deserves a little more explanation. See, Facebook decided to tie comments to exact web addresses. So if you have a post with the address http://mysite.com/blog/a-post/ and people leave Facebook comments on it, Facebook attaches those comments to the exact URL http://mysite.com/blog/a-post/, as opposed to some numeric ID or unique identifier string.

What that means is if you ever change your blog address in such a way that the same post is now found at the URL http://mynewdomain.com/a-post/, all of your Facebook comments will be lost. This is true even for small changes in your permalink structure — if the URL changes at all, it breaks the association between the comments left when the post had a different URL and the post itself. Kinda lame, I know, but it makes sense from Facebook’s perspective and there’s not much we can do about it.

Anyway, the fact that ProPhoto scrapes all of the comments left through Facebook solves this problem, as best as is possible. If you’re using Facebook comments with ProPhoto, when we store a local copy of each Facebook comment in your WordPress database, we make a note of what the post’s exact URL was when the comment was added into Facebook. Then, if you change your blog address or permalink structure, ProPhoto can compare the two URLs and see if you have any orphan Facebook comments. If you do have some of these, ProPhoto can display these old orphaned Facebook comments as traditional Facebook comments.

How do we “PULL” the comments?

Excellent question. Facebook gives us a way to “listen” with JavaScript for new comments added through Facebook. When a new comment is added, our ProPhoto JavaScript is notified. Then, we make an ajax-request to the Facebook public comments API and figure out which comment was just added. We then download the text and other details about the Facebook comment, and insert it programmatically into your WordPress database.

It works great — most of the time. Occasionally the Facebook API is down, or returns a whacky error, and there’s a known Facebook bug that means that our “listener” doesn’t get notified if the comment is added via a mobile device. Because of this bug and the periodic problems with the API, we also check each WordPress post once every three weeks to re-sync your WordPress database with all of the comments left on Facebook, to catch any comments that fell through the cracks. It’s not a foolproof system, but it should catch and sync the vast majority of all comments left within Facebook.

What’s next?

Facebook comments was the last big part of our recent, 2-month long, Facebook-centric development push. We’ve reworked and improved Facebook Like buttons, Like box widgets, added Send buttons, improved og:meta compliance, added more granular controls for how Facebook previews your links, and now added Facebook comments.

Now that we’re done working on Facebook, we’re likely going to spend a week or two on Grids. Grids are an awesome feature that people really love, and we want to add some oft-requested new customization options and other improvements, including likely at least one more entirely new grid display option. So stay tuned for more on that in the days and weeks to come.

I’m also probably going to review all of the open development tickets and pick off some of the higher priority smaller but often requested items as well.

Get a $30 rebate when you choose our recommended host, Hostpapa