FriendConnect Login Plugin

Google Friend Connect (GFC) allows users to become members of your site community using their Google, Yahoo!, AIM or OpenID accounts and do lots of stuff like interacting with other visitors by making friends, sharing media, posting comments, playing games, and more. To find more information about Google Friend Connect you may go here.
Unfortunately users logged using GFC still have to enter their name, email address and website to post comment via WordPress (or even register and login via WordPress in case “Users must be registered and logged in to comment” option is turned on). Fortunately there are several plugins (official one and FriendConnect commenting plugin by Joost de Valk) which fix this problem.
ALSO there is FriendConnect Login Plugin which I wrote myself :-).
I’m not going to tell you how first two plugins work. Instead of that I will briefly explain how my plugin works.
For each GFC account plugin creates exactly one WordPress (WP) user which is then used to interact with the site. When GFC user signs in - corresponding WP user is logged in, when GFC user signs out - corresponding WP user is logged out. By default plugin allows to sign in using either WP or GFC account, but you may also configure it to allow sign in using GFC account only. That’s very simple.
Installation and configuration
- First of all set up you site with Google Friend Connect.
- Download plugin.
- Unzip it and upload to your plugins folder.
- Activate (Plugins->Installed) and configure (Settings->FriendConnect Login) plugin from Admin panel.
- Adjust you theme:
If you allow only Google Friend Connect users to login WordPress then:
1) Remove all logout links or replace them with the following one:
<a onclick="google.friendconnect.requestSignOut()" href="#"><?php _e('Sign out'); ?></a>
2) Remove all links to user profile. In case Google Friend Connect user will change his password plugin won’t log him in after that.
If you allow both WordPress and Google Friend Connect users to login WordPress then your code should distinguish user type and generate logout and profile links appropriately. Here is an example:
<?php _e('Logged in as '); // Do not add link to profile and logout link in case of GFC user global $gfc_userdata; if ( ! isset($gfc_userdata) ) { echo '<a href="' . get_option('siteurl') . '/wp-admin/profile.php">' . $user_identity . '</a>. '; echo '<a href="' . wp_logout_url(get_permalink()) . '" title="' . __('Log out of this account') . '">' . __('Logout ') . '»</a>'; } else { echo $user_identity . '. '; echo '<a href="#" onClick="google.friendconnect.requestSignOut()" title="' . __('Log out of this account') . '">' . __('Logout ') . '»</a>'; } ?>
By default plugin adds Sign In button (or user’s profile data in case he/she is already signed in) under comment form. Alternatively you may use following template tag to do this:
<?php if (function_exists('gfc_profile')) {gfc_profile();} ?>
Best place to put it is under comment form or “You must be logged in…” line in your comments.php.
PHP 4 >= 4.0.6, PHP 5
At the moment plugin was tested with WordPress v 2.7.1 and seems to be fully compatible :).
Version 1.0.3
- removed class constants due to the fact that PHP 4 does not support them;
- added check whether “json_decode” function exists. And if it is not Pear JSON library is used. Thus plugin should work with PHP 4 >= 4.0.6, PHP 5;
- fixed Settings link.
Version 1.0.2
- added possibility to specify location of GFC core files at settings page;
- now both WP and GFC users are supported.
Version 1.0.1
Added setting page to admin side to allow user to:
- enter SITE ID;
- choose between using “comment_form” action and template tag;
- enable/disable default css;
Version 1.0
Created. Main differences (improvements) over official plugin:
- completely server-side. FCauth method is used to authenticate GFC user;
- GFC user ID is used to create WP user (plugin doesn’t create new WP user on GFC username change);
- added template tag to be used in themes;
- changed CSS;
- user is logged out in case he/she signs out of Friend Connect;
- only GFC users may sign in;
Last versions of plugin and all available documentation you can download here.
Don’t be very strict critisithing my plugin. It’s my first WordPress plugin experience. Moreover it is my first PHP/Java/OpenSocial API experience :-). Do not hesitate to contact me: your comments, proposals, thanks etc are highly appreciated.
WP user test comment…
GFC user test comment…
Non-registered user comment…
Works great, thank you
Thanks for the great job.
I am totally new to Wordpress and I do not know what file to edit or settings to change when you write “Adjust you theme” What needs to be done?
Thanks!
One comment won’t be enough to answer your question. Check http://codex.wordpress.org/ . This link may be a good start http://codex.wordpress.org/Using_Themes . In case you still have questions, please submit them here: http://wordpress.org/tags/friendconnect-login
Thanks
Thanks for the advise! There are some great resources.
I have installed your plugin but I am getting the following under all comment areas on the site:
[:en]Settings[:ru]Настройки
[:en]Invite friend[:ru]Пригласить друга
[:en]Sign out[:ru]Выйти
Thanks for reporting. My mistake. Thing is that I use qTranslate plugin to blog in two languages and I didn’t clean those strings before submitting plugin.
Now it is fixed. Please re-download and re-install plugin.
Thanks!
I get this error when I try to activate plugin
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /nfs/c03/h04/mnt/57115/domains/chinahush.com/html/wp-content/plugins/gfc_plugin.php on line 70
Most probably you have PHP4 and plugin requires PHP5 due to the class constants used.
You may edit plugin yourself and fix this or you can wait a few days and I will fix this myself and update plugin.
I am running php 5, also i have tried the official plug-in and the other one. but I get a problem when I sign in, the page will keeps on refreshing. Have you seen this problem?
1. Please update to plugin version 1.0.3. This may solve your problem.
2. Official plugin uses GFC user displayName as username. In case user with the same username is already in WP DB plugin may act as you described. But this may be not the only reason.
[...] specific are (for the sake of completeness): Audio player, Broken Link Checker, External Links, FriendConnectLogin, Login LockDown, Referrer Detector, Samsarin PHP Widget, WordPress Database Backup and WPtouch [...]
How well does this work with WP Super Cache?
Hmmm… Actually I don’t know
If it is not difficult for you please check that and tell us about results
Is there a way to just add the button and not the two lines above and below the Sign In button?
Yes, there is. Follow these steps:
1. Uncheck “Use default CSS” at plugin options page;
2. Sign In button is enclosed in
<div id="gfc_profile">. You may style it the way you want;First, thanks for the great plugin Shahin. I just installed it without a problem. (Well, I did have one issue with my spam filter, but that seemed to rectify itself by enabling the back-up reCaptcha. I’m using the TanTanNoodles plugin.) Anyways, I noticed that Mike mentioned WP Super Cache above. That’s actually what I was coming to post about!
Personally, I did notice some issues with signing in on pages I had already “visited”. I’m assuming it’s a WP Super Cache and not a browser cache issue. On pages I visited for the first time, signing in and/or commenting seemed absolutely fine. Perhaps it was more problematic because I was testing it, but I could see it potentially being an issue for normal users also.
Thanks for a comment, Kate. Can you please provide me with detailed description of issue you faced?
Unfortunately at the moment I don’t have enough time to test/resolve it myself. Hope I will have a chance to do that after 25th of June
hi,
I successfully installed this plugin but, I got a problem in submitting a comment for a specific entry (post), hope you can help me
1. I used the plugin “iF AJAX Comments For WordPress” (AjaxComment) to validate and submit the comment. Everything works fine.
2. Then I installed this plugin FriendConnect Login. I could sign in, but when I submitted the comment for a specific post, plugin AjaxComment reported “the comment is submitted”, but when I check the Dashboard, there’s no new comment. I did check it in Spam, but there’s nothing.
I’m stucking in this mess …
plz help
bowlkhin
1. FriendConnect Login does not deal with comment posting. So I’m 99% sure that it’s not its fault.
2. Because of 1% I tested plugin you mentioned. And I have two news for you:
- GOOD ONE: during the tests I didn’t lose any comment;
- BAD ONE: when comment is posted iFAC updates page for a second time and because of that my plugin reloads it. This means that there is no sense to use iFAC this way
When I will have free time I will think about solution, but for now that is all.
Good luck!
Great plugin. Thank you very much.
What if one don’t want to create WP-Users but still want comments to be posted from friendconnect user ?
If you won’t create corresponding WP User for GFC user how will you log him in?
I guess there is no way to do that.
I was looking for FriendConnect plugins to allow people using it to join and follow my site as well as comment, but I can’t see to find any that don’t add WP Users.
My site has one user: Me. That’s the way I want it, that’s the way I’m keeping it. If somebody wants to comment more easily using GFC, then I’m all for that. But why on earth do you have to create a user specifically for them? Why can’t you simply use the Google API’s to get their information and put it in the proper places in the anonymous commenting form?
I don’t want people logging into my site. I want people to be able to more easily comment. That’s it. If you have to make a WP user for them, then I can’t use your plugin.
Interesting idea. I will think about adding such an option. Thanks.
This is a good template
This is awesome. I don’t really understand the technology. It just lets people login with other accounts so they don’t need to create another one. Pretty useful considering some people have hundreds of passwords.
Thank you for this plugin!
Just I’d like to let you -and the reaedrs- know that WP Super Cache and Friend Connect plugins work well together, as everybody guessed
Warning: Missing argument 5 for gfc_wp_get_avatar() in in /home/… line 366
the plugin works great but the comments are messed
up by this error all over for each gravatar
the gravatars are showing up
google shows some other sites with this error
any idea how to solve this ?
wpmu 2.71 the error Missing argument 5 for gfc_wp_get_avatar is related to
http://wordpress.org/extend/plugins/add-local-avatar/
whice is not comapatble with your plugin
i’v disabled that plugin and all work fine
my biggest problem now is fixing facebook connect
compatability
your plugin disables fbconnect avatars
any idea how to solve this ?
Oh hey, this looks good!
tEST
Sorry I just comment to comfirm the effect of this plugin
My problem is I installed and activated it however when GF logs in and post their avatar does not display. Please help.
I have it set to show avatars. I was formerly using profile pic plug in but the two created errors so once I removed profile pic and just had gfc log in the errors were gone, but I still do not get their avatar image with their post. Please help!
also i noticed it was not compatible with commentluv
thanks
The plugin is working fine, but I can´t get user avatar being displayed in comments.
Am I missing something?
Could you please show your comments code?
Thanks in advance!
Cool plug in
rttrry
thanks
cool
Very Good FRIEND!!!!!!!!!!
thanks
Jejeje
Thank you
teste
so thank!
test
[...] add the support to the Google Friend Connect here in this blog yesterday by the fantastic WP plugin FriendConnect Login [...]
Great plugin, but avatars don’t show up in the comments
test
I want to test…
Hello,
I feel stupid but after setting up the id in the plugin option, what am I suppose to see on my blog: a toolbar ?
Thanks.
Nothing actually
unless you add piece of code to your template.
Just testing to see if you need to be logged in with gfc to make a comment.