WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Simple Facebook Connect] New features - need testers for trunk (58 posts)

  1. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    I made some *vast* improvements to the comments system with the Simple Facebook Connect plugin.

    Comment emails: If you have the “Comment author must fill out name and e-mail” checked in Settings->Discussion, the comments plugin will now ask the Facebook user for Permission to email that user. This will allow things like replying to the comment emails and Subscribe to Comments and similar plugins to work with Simple Facebook Connect. Yes, you can actually reply to the Facebook comments when the comment from WordPress gets emailed to you, and the reply *works* and sends back to the comment author through Facebook. Tested, proven.

    The Comments plugin now uses the comment meta table for storing FB user id, making for *much* quicker avatar generation. Avatars used to be built by getting FB UID from the email field, which took time for regex parsing. Old avatars will be auto-converted to new method when displayed. This also has an advantage in that there’s now an ‘fbuid’ comment meta field on every facebook connected comment, to tie back to the author of the comment.

    Comments now use far smarter Facebook JS to get relevant information (name, profile_url, proxied_email), making comments javascript a bit more sane and non-hacky.

    On the whole, I think it works better, but since it’s really beta, I’ve also split the plugin into tagged versioning. I’d like some testers to help me out and find bugs, actually.

    The current stable version is 0.9 and lacks these new comments enhancements, but if you want to use the latest trunk code, you can get that trunk code via SVN here: http://plugins.svn.wordpress.org/simple-facebook-connect/trunk/

    http://wordpress.org/extend/plugins/simple-facebook-connect/

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    See, if I'd had more testers, I would have known that the comments plugin wasn't working much sooner. :)

    It is working now, and much better too.

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    SFC-Register plugin now in beta for anybody wanting to use it.

    I'd like feedback on how it works and how it should work, according to people who will be using it.

  4. whiteknightuk
    Member
    Posted 4 years ago #

    Hi Otto there seems to be a problem commenting.

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/sites/pspcentre.co.uk/public_html/wp-content/plugins/simple-facebook-connect/facebook-platform/facebook.php on line 38

    Also Seems to be a problem with the Share Button in Chrome and IE8 - I can click on the share button and then a popup appears but then thats it (was working on 0.9) also note I am not logged into my facebook - also may I ask why you are using http://www.bzhang.devrs007.facebook.com/ for the Share Button I have used other sites and they are using straight facebook.com :)

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    whiteknightuk: PHP 5 is required, because Facebook doesn't make PHP 4 versions of their client code. The old javascript way in the comments plugin is frankly a paint in the ass and never worked properly, so I switched to using their client code and doing the work in PHP instead.

    If you don't have PHP 5 enabled by default on your hosting, then ask them how to turn it on.

    More info: http://wordpress.org/support/topic/316394

    I have no idea what you're talking about with the share button. I don't use any URL in particular, I just put the share button link into the code. What Facebook does with it is Facebook's problem.

  6. whiteknightuk
    Member
    Posted 4 years ago #

    I will enable PHP5 now.

    As for the Share button, yes it works fine, but for example if you are not logged into facebook, then you click the share button it comes up in a popup window (with a browser window not a fancy facebook one) and in the url bar you see the URL to http://www.bzhang.devrs007.facebook.com/

    Just wondered why I hadnt seen it before as everywhere I test it seems to befine.

    Do you see what I mean?

  7. whiteknightuk
    Member
    Posted 4 years ago #

    UPDATE: Got it working now with PHP5 enabled :) - Nice there is no re-load when the user connects to facebook (is that right?). Stays in the postion you last left the scren.

    Also after the comment had being posted there was a big delay in the Pop up window saying publish to your wall? Might be my connection but works fine :) - Just one thing about the publish after comment it dosent take a thumbnail of the post?

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    There may be a slight delay in the publish after comment thing, as it has to wait for the page to load completely for that to work properly.

    If there are images in a post, then it should grab them as thumbnails. Although if the post is relatively new, Facebook may not show them immediately. Facebook has to go grab those images itself and make proper thumbnails and such. I'd need to see a link to a post where the images are not showing up to diagnose any problems there.

    Never seen the popup URL like that, but that's Facebook for you. I assume that's something weird with the way they do things.

  9. whiteknightuk
    Member
    Posted 4 years ago #

    Testing out SFC-Login and SFC-Register Using FF3:

    I went to wp-login.php and tried logging in with Facebook Connect, the connect button appeared and I used my login details and hit ok on the fb popup. It went back to wp-login.php and nothing had changed?

    I then enabled the register plugin and clicked Register from wp-login.php - I get a button saying "Logout of Facebook Connect" even though im not logged in and it says a password will be emailed to you.

    Now having enabled SFC-Register and I go back to wp-login and say Connect with Facebook it connects and takes me to the register section with my Facebook details filled in. I hit register and it goes to a White Screen. I havent recieved an email.

    Thats all I got so far. What do you suggest

    Cheers

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    SFC-Login only works if you have already logged into WordPress and connected your WP account with your FB account (on the Your Profile page). Otherwise, it won't do anything, much as you discovered. If you login with Facebook and it can't figure out which WordPress user you are, then you don't get logged in.

    SFC-Register makes the same login button, when it can't figure out who you are, go instead to the new user registration screen with your user details already filled in (after you approve the "email" permissions, if you have not already). It does not make the normal "register" link do anything special, really.

    I've corrected the mistakes in the register plugin now. For example, you won't see the disconnect button any more unless you're actually connected (you'll see a normal connect button now). Clicking the Register button with that filled in now actually works and fills in the user info properly (First and Last name, profile URL, etc) instead of erroring out or white-screening. The WP user just created gets automatically connected to the FB account, meaning that the login-with-facebook instantly works for that new user. And the emails will get sent properly.

  11. whiteknightuk
    Member
    Posted 4 years ago #

    Sounds good, glad things are getting ironed out :) I recommended your plugin on a thread I started on ThemeForest.net, hope that will give you a little exposure. I will write an article on my own blog once I have time.

    Hopefully this weekend I will look at the Plugin more and see if I can offer any user friendly suggestions :) but thumbs up with the plugin defiantly the best one out there in my opinion.

    Chris

  12. whiteknightuk
    Member
    Posted 4 years ago #

    UPDATE: Ok uploaded the new SFC-Register, new little bug.

    I am a new user, I try and login using FB, it allows me to login using FB details then it forwards me to the Register section as it knows I havent got a login for the site. Which is good, at this point the Username is my full name, then the email section is an email but looks like this (apps+25...204f85a8@proxymail.facebook.com)

    Its looks like that but it works and logs me in to the WordPress Dashboard. I also get an email with my login details for the site (WordPress Login Details)

    Next I can explore the site and comment - this works fine (no facebook profile picture showing like when you just use normal FB Connect) but the commenting works fine.

    Now when I want to logout and use this action
    wp-login.php?action=logout it says do I want to log out and I say yes but it takes me back to the user dashboard and dosent log me out. I can only use logout from within the Dashboard where it says you are now logging off FB and the website. But then infact if your go back to the main site I am still logged into FB and can leave a comment. The only way to really logout is by going to wp-login and clicking the blue button logout from Facebook Connect.

    Hope that helps, its just my findings :)

  13. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    The "apps" email address is the proxied email. It's sorta the old style email. If you want to get the normal email address from Facebook, you have to do a few things (they just started this up yesterday).

    (BTW, don't ever pass out one of those apps emails to anybody. Facebook says your app has to keep those private.)

    1. Go to your Facebook Application. Edit the Settings. On the Advanced tab, there's a place to put in your "Email Domain". This needs to be set to the base domain of your site (no www or anything).

    2. For your own testing, you've probably already granted the "email" permission to the Application. Now you need to revoke that permission so that the popup happens again. Go here: http://www.facebook.com/editapps.php?v=extended and find your app. Edit it, and remove the email permission. Normal "new" users wouldn't have this permission granted already anyway.

    3. Now when you test and it asks for permission, it'll give you a choice of whether to give your normal email or the proxied one. Whichever you choose is the one that gets used.

    Re: Logout links: Update the wp-login plugin. I made some changes to that to try to fix the logout links up and make them act better. Logging out using the upper-right corner link will pop up the "you are logging out of both" now and actually follow through with it.

    However, a normal visit to wp-login.php?action=logout will NOT log you out. See, you're still logged into Facebook and connected to the site. The authorize recognizes your Facebook credentials and logs you back in as you, like it is supposed to do. Once you're using SFC-Login and are logging in with Facebook, you cannot log out without logging out of both the site and FB.

    While it would be entirely possible to make the action=logout links go to a page and then prompt you log you out of Facebook as well, I didn't think that that would be a particularly good user experience. There is *no* other way to do it. The whole login via Facebook thing requires that when I can recognize the Facebook user, to log them in accordingly. The only way Facebook really provides to *stop* recognizing the user is to log the user completely out of Facebook.

    Re: Avatar: I didn't plan on pulling the Facebook Avatar and using it for login, as I figured most people would prefer to use gravatars.

  14. whiteknightuk
    Member
    Posted 4 years ago #

    All sounds good. I will probably not be able to look into this until tomorow. The avatar though, not many people out of the "Web World" know about Gravatars, my audience for one site no nothing about web apart from Facebook for example.

    I was reading about the new Email settings on Facebook Connect FB page I will let you know when I have added it to my website.

    I just posted a feature request or something to think about - Invite FB Freinds to your website.

    Cheers

  15. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    I suppose I could break the facebook avatars out of the comments plugin and into its own plugin, with an option to prefer them over regular gravatars.

  16. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    This code added to the end of the login plugin will make it show Facebook Avatars in the admin pages (but NOT on comments!), for users who use the Facebook Login mechanism:

    // generate facebook avatar code for users who login with Facebook
    add_filter('get_avatar','sfc_login_avatar', 10, 5);
    function sfc_login_avatar($avatar, $id_or_email, $size, $default, $alt) {
    	// check to be sure this is for a user id
    	if ( !is_numeric($id_or_email) ) return $avatar;
    	$fbuid = get_usermeta( $id_or_email, 'fbuid');
    	if ($fbuid) {
    		// return the avatar code
    		return "<div class='avatar avatar-{$size} fbavatar'><fb:profile-pic uid='{$fbuid}' facebook-logo='true' size='square' linked='false' width='{$size}' height='{$size}'></fb:profile-pic></div>";
    	}
    	return $avatar;
    }

    In the SFC-Comments plugin is this code:

    if ( !is_object($id_or_email) || !isset($id_or_email->comment_ID) || $id_or_email->user_id)
    	 return $avatar;

    If you change it to this, then the Facebook Avatars will be preferred over Gravatars for comments display:

    if ( !is_object($id_or_email) || !isset($id_or_email->comment_ID))
    	 return $avatar;
  17. whiteknightuk
    Member
    Posted 4 years ago #

    Okay thats really good :) I will try implement it tommorow

  18. whiteknightuk
    Member
    Posted 4 years ago #

    Hey,

    Im having trouble showing the Bookmark button.

    Does there have to be an option on the Application Settings for it to be shown?

    Im wanting it to be shown even if the user isnt logged into facebook (I cant see the button at all at the minute)

    Cheers

  19. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    All the plugin does is to insert the relevant XFBML code for the bookmark button. Whether Facebook shows the button or not is entirely up to Facebook. I have no control there.

    However, do make sure you put a "Bookmark URL" in on your Facebook Application Settings.

  20. jay.weeks
    Member
    Posted 4 years ago #

    if ( !is_object($id_or_email) || !isset($id_or_email->comment_ID))
    return $avatar;

    can't seem to get this to work

    using this in comments.php :

    <span class="avatar"><?php echo get_avatar( $comment->user_id, $size = '30'); ?></span>

  21. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    This is wrong:
    get_avatar( $comment->user_id, $size = '30');

    Change it to this:
    get_avatar( $comment, 30);

  22. james_reinhardt
    Member
    Posted 4 years ago #

    I've been following the info above, as well as some other web searches, and as a novice coder I'm having difficulty getting my blog to display the facebook avatars in the comments.

    I was able to integrate the facebook connect, and the "SFC - Comments" plugin very easily. It's working flawlessly. The avatar will show when I have logged in, but does not show in my comment.

    Can anybody help? I'm stumped. Thanks in advance.
    -James

  23. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    Look at your theme. Somewhere in it is a call to "get_avatar". Probably in the comments.php file. Post that and I'll tell you how to modify it to be correct.

    For almost all themes, there's nothing you have to do. If the theme author wrote his theme correctly, then it just works.

    If you mean, on the other hand, that the theme doesn't show avatars in comments at all, then all you have to do is to add the get_avatar($comment, 32); code yourself. The "32" is the size of the avatar to be displayed.

  24. james_reinhardt
    Member
    Posted 4 years ago #

    Otto-
    Many thanks for your assistance. The avatars are displayed within the theme, and it will properly pull Gravitars, but will not pull the image from facebook for display.

    The get_avatar comes from a library, the applicable code is below.

    Thanks again!


    * Displays the avatar for the comment author and wraps it in the comment author's URL if it is
    * available. Adds a call to THEME_IMAGES . "/{$comment_type}.png" for the default avatars for
    * trackbacks and pingbacks.
    *
    * @since 0.2
    * @global $comment The current comment's DB object.
    * @global $hybrid The global Hybrid object.
    */
    function hybrid_avatar() {
    global $comment, $hybrid;

    if ( !get_option( 'show_avatars' ) )
    return false;

    /* Get/set some comment variables. */
    $comment_type = get_comment_type();
    $author = esc_html( get_comment_author() );
    $url = esc_url( get_comment_author_url() );

    if ( 'pingback' == $comment_type || 'trackback' == $comment_type )
    $default_avatar = THEME_IMAGES . "/{$comment_type}.png";

    $default_avatar = apply_filters( "{$hybrid->prefix}_{$comment_type}_avatar", $default_avatar );

    $avatar = get_avatar( get_comment_author_email(), '80', $default_avatar, $author );

    /* If URL input, wrap avatar in hyperlink. */
    if ( $url )
    $avatar = '' . $avatar . '';

    echo apply_filters( "{$hybrid->prefix}_avatar", $avatar );
    }

    /**`

  25. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    Change this line:
    $avatar = get_avatar( get_comment_author_email(), '80', $default_avatar, $author );

    To this:
    $avatar = get_avatar( $comment, '80', $default_avatar, $author );

  26. james_reinhardt
    Member
    Posted 4 years ago #

    Otto-
    Thanks so much for your assistance and a fantastic plugin.

    "Beer Money" will be on the way in a few days!

    -James

  27. rpetersnmt
    Member
    Posted 4 years ago #

    Otto - Hey, I've installed your SFC plugin(s) and have successfully gotten comment Avatars to load and am very impressed with all of the work that you've done. I have a couple comments/questions and am hoping that maybe you can provide some reflection and/or options for me.

    1. I think that the userbase for my project will be best served by showing Avatars in this order: Facebook (if logged in), Gravatar (if available), then the default icon. It seems like the testing I've done with various users has resulted in a bit of confusion as to why the Post author (who is also logged in via Facebook) doesn't get an Avatar and the commenters do. Any suggestions for how I could solve this or some code I can try? I've been scouring the web for solutions and trying several things of my own to tie into your plugins and pull a user's FB avatar, alas I've have come up empty handed.

    2. I guess this is more of a simple comment. It seems that people who arrive at the register screen (that is now Facebook enabled) are confused by whether they need to create an account or if they can just use Facebook credentials. If you added a way for the site owner to add some (optional) descriptive text explaining the registration process, and how it relates to Facebook Connect, I think it'd make it possible to clear up a bunch of ??? for people.

    That's all...thanks a ton.

  28. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    1. There's some avatar code at the bottom of the sfc-login file that is commented out. You could try that. No guarantees that it works properly, it's something I was working on. I haven't really decided the best way to do this sort of thing yet.

    2. I'm not sure what descriptive text should be added there. But yes, basically, they're making a WordPress account that is linked to their Facebook account. That could be made more transparent, I suppose, but the cost is the user not knowing their WP login info, which I dislike.

  29. mrjcleaver
    Member
    Posted 4 years ago #

    RE: 1 - what design decision are you thinking through?

    I see:

    /*
    // generate facebook avatar code for users who login with Facebook
    // NOTE: This overrides Gravatar.
    //
    add_filter('get_avatar','sfc_login_avatar', 10, 5);
    function sfc_login_avatar($avatar, $id_or_email, $size = '96', $default = '', $alt = false) {
    // check to be sure this is for a user id
    if ( !is_numeric($id_or_email) ) return $avatar;
    $fbuid = get_usermeta( $id_or_email, 'fbuid');
    if ($fbuid) {
    // return the avatar code
    return "<fb:profile-pic class='avatar avatar-{$size} fbavatar' uid='{$fbuid}' facebook-logo='true' size='squ
    are' linked='false' width='{$size}' height='{$size}'></fb:profile-pic>";
    }
    return $avatar;
    }
    */

    but nothing particularly commented out?

    Thanks, Martin.

  30. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    That whole section is commented out. See the /* and */ surrounding it?

Topic Closed

This topic has been closed to new replies.

About this Topic