FriendConnect commenting plugin

friendconnect-logoWith Google FriendConnect, you could already allow people to become a “member” of your sites community, and do all sorts of fun stuff with that. But when they were logged in like that, they still had to enter their name, email address and website. This FriendConnect Commenting plugin fixes that.

Download this plugin

You can now allow visitors to log in with their FriendConnect ID, and leave a comment with that same ID. This means that your visitors can log in with their Google, Yahoo!, AIM or OpenID account, by just clicking a button that looks like this:

friendconnect-button

How does this work?

When someone logs in to your site using Google FriendConnect for the first time, this plugin makes a new user in your WordPress database for them. This means that all the comments in your system by that person will still be associated with that person.

I want this, what do I do?

  1. If you haven’t yet, set up your site with Google FriendConnect.
  2. Extract your site’s ID from your “Site settings” link in Google Friend Connect. You will find that link here:
    friendconnect-settings
    Copy the URL for the Site settings link, it’ll look something like this:

    http://www.google.com/friendconnect/admin/site/settings?id=04971608044670083686

    The long number at the end of the URL is your site’s ID.

  3. Now, download this plugin.
  4. Unzip it and upload the friendconnect directory to your blogs /wp-content/plugins/ directory.
  5. Enter your FriendConnect site ID in the backend for the plugin under Settings => FriendConnect.
  6. You’re done!

But wait, there’s more!

There’s two ways to use this plugin. By just installing it as describes above, people can use their FriendConnect account to comment. The real value comes however, when you force people to register before they comment: if you follow the following instructions, they’ll still be able to log in using FriendConnect, so they can comment easily, without having to register and remember a new password for your site, and you get rid of comment spam!

To allow for this, you’ll need to open up your themes comments.php file, and find the following lines:

if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be ....

Right below that, you add the following lines:

<?php if (function_exists('fc_wp_comment_form')) {
  fc_wp_comment_form(); 
} ?>

That’s it. Now you can go to your WordPress Admin, Settings => Discussion, and check the box next to “Users must be registered and logged in to comment”. If someone now wants to comment, he either has to register on your site (if you allow people to), or login through FriendConnect.

All done?

Now don’t forget to follow me on Twitter or subcribe to this blog by email or through the RSS feed, so you’ll be sure to hear about any updates to this plugin!

Thanks

Major thanks go out to Matt Cutts and Anindo Mukherjee of Google for helping me develop and test this plugin!

Known issues

  • Currently, the API that allows for this way of logging in, doesn’t return a URL for the user, so the user get’s assigned his/her local FriendConnect URL. As soon as the API does return another URL, we’ll update this plugin to make sure we can set a better URL.
  • This plugin isn’t listed on WordPress.org yet. We’re working on that!

Tags: ,