Simple Facebook Connect
[resolved] multiple comment forms on the same page (9 posts)

  1. misthero
    Posted 6 years ago #

    Hi all, I'm having a little problem, I'm writing a simple page template for a Facebook Canvas Page.

    Adding multiple comments forms for multiple posts on a same page is easy with wordpress and I have no problems until I'm logged in WP normally

    If I logout from WP and try login with facebook I can comment only on the first post of the list, on the other posts I see the "connect with facebook" button, but I'm already connected and connecting again does nothing..

    here is my sample page: http://lukart.net/facebook/

    what am I doing wrong??

    Thank you!

  2. Samuel Wood (Otto)
    WordPress.org Tech Dude
    Plugin Author

    Posted 6 years ago #

    Make sure that your URL in your facebook application settings is the base URL which all the URLs share. Probably http://lukart.net/ for you.

    Facebook sets cookies on your site with that URL, and that's how it knows you're logged in or not.

  3. misthero
    Posted 6 years ago #

    thankyou for you answer Otto, I know that, and it's working in my site.

    I need to explain the problem better.

    I can login with facebook and comment in single.php

    but I have created a page with 5 posts and every post have comments displayed below. Just like in a facebook wall page where you can comment for every item you have.

    What happen there is that I can comment only on the first post! Other posts out of the wp-query shows "login with facebook" but cannot comment there...( unless I'm logged on WP normally )

    you can see what I'm trying to describe here: http://lukart.net/facebook/

    as a side question I'm even triyng to create a filter for the the function <?php comment_form(); ?>
    like you explained here: http://ottopress.com/2010/wordpress-3-0-theme-tip-the-comment-form/

    I would like to add

    <div id="comment-user-details"><br />
    <?php do_action('alt_comment_login'); ?><br />

    around the comment form, have you some hint for that?

  4. misthero
    Posted 6 years ago #

    I think the problem is with this jQuery

    // Show their FB details TODO this should be configurable, or at least prettier...<br />
    	if (!jQuery('#fb-user').length) {<br />
    		jQuery('#comment-user-details').hide().after("<span id='fb-user'>" +<br />
    		"<fb:profile-pic uid='loggedinuser' facebook-logo='true' size='small' height='30'></fb:profile-pic>" +<br />
    		"<span id='fb-msg'><strong><fb:intl>Hi</fb:intl> <fb:name uid='loggedinuser' useyou='false'></fb:name>!</strong><br /><fb:intl>You are connected with your Facebook account.</fb:intl>" +<br />
    		"<a href='#'>\"); return false;'>Logout</a>" +<br />
    		"</span></span>");<br />
    		jQuery('#sfc_comm_send').html('<input style="width: auto;" type="checkbox" id="sfc_comm_share" /><label for="sfc_comm_send"><fb:intl>Share Comment on Facebook</fb:intl></label>');<br />
    	}<br />

    Probably I'm wrong, I'm not a javascript expert, but I think this work only for the first instance and do nothing with the rest... maybe

  5. misthero
    Posted 6 years ago #

    ok really it IS working, and you can comment, but appear like it is not because it doesn't hide the #comment-user-detail. and the "connect with facebook" button.

  6. Samuel Wood (Otto)
    WordPress.org Tech Dude
    Plugin Author

    Posted 6 years ago #

    Ah, yes. There is an inherent assumption there that there's only one comment section per web page.

  7. misthero
    Posted 6 years ago #

    and.. probably it doesn't change #comment-user-detail beacuse it is an ID and not a class and Ids are supposed to appear only once per page..

    that's drive me back to my secondary question.

    ho do I crate a filter for the comment_form function to change the container id/class?

  8. misthero
    Posted 6 years ago #

    ok .. I was getting crazy because I tought that the ID comment-user-detail was some default in wordpress and couldn't fint it, until I got you definet it in the sfc-comments.php.

    what I have done is changing

    add_action('comment_form_before_fields', 'comment_user_details_begin',1,0);
    function comment_user_details_begin() { echo '<div id="comment-user-details">'; }


    add_action('comment_form_before_fields', 'comment_user_details_begin',1,0);
    function comment_user_details_begin() { echo '<div class="comment-user-details">'; }


    then I changed to a class the "sfc_comm_send" too and defined:

    this way the "share comment on facebook" checkbox is displayed for every post.

    don't know why it's not selected by default now, but this already is a big step on for me :p

    I'm only scared that if you udate the plugin I will lose all those changes now...

  9. misthero
    Posted 6 years ago #

    well I can say that the issue is solved after changing the div ids to classes, I can't notice any issue.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic