How do I remove a facebook comment warning?
Asked Answered
I

4

2

my fb comments code is:

<fb:comments    url="<?=$this_url?>" width="600"  xid="<?=$this_unique_xid?>" notify="true"  candelete="true" simple="1" numposts=1  url="http://www.veethi.com"></fb:comments>

Now if i want to remove the warning message:

Warning: this comments plugin is operating in compatibility mode, but has no posts yet. Consider specifying an explicit ‘href’ as suggested in the comments plugin documentation to take advantage of all plugin features

I need to replace "url" to "href", but by doing this i lose my old comments, Is anyone who facing the problem or solution pls, reply me. I need one solution that remove the warning message and the same way i have all my old comments. thankx in advance.

Interoffice answered 13/12, 2011 at 10:7 Comment(0)
F
3

I wrote a complete tutorial with a small use of JS to solve this issue. Visit the tutorial


What I did was:

  • Set off the parse for XFBML tags in the JS SDK
  • Adding a function-call to the JS SDK with a date parameter that you manually set it once with a date that posts published after that date will start using the 'href' version, and posts published until that date will use the migrated version.
  • Adding another attribute to the fb:comments tag which is 'data-date' and in it's value you place your post date (dynamic code).
  • Calculating the dates in a JS code, and base on the result it's removing the not wanted attributes, and finally then it's render the XFBML tags using FB.XFBML.parse
Flareup answered 13/12, 2011 at 10:8 Comment(5)
What if you're using this code: ` <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=1234567890"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>`Spirt
@TCC It better to load the JS SDK asynchronously as you can find the code for it in the official JS SDK documentation and in my tutorial . But if you wish to use the one you posted here then change xfbml=1 to xfbml=0 , and add a script after it with the fbcRender function call like this: <script type="text/javascript">fbcRender('12.15.2011');</script>Flareup
@TCC OK I tested it and it works like this: 1. set the xfbml=1 to xfbml=0 ///// 2. add this script after your JS SDK: <script type="text/javascript"> window.fbAsyncInit = function () { fbcRender('12.20.2011'); }; </script>Flareup
I have a hard time to see the benefit of your solution - probably I lack some knowledge about boundary conditions. Are you saying that it is not possible to replace the old xid-based comments with the new href version without loosing the old comments? That can't be true!Ladner
Just wanted to add that the workaround above can be a viable solution as the xid-based comments will continue to work despite the fbml removal. See #10437885 for more information.Ladner
B
1

Instead of <fb:comments ..., I used <div class="fb-comments" ... and then everything worked correctly.

Baresark answered 30/1, 2012 at 14:0 Comment(0)
P
1

https://developers.facebook.com/docs/reference/plugins/comments/

Put your website URL, set the number of posts that you want to have in comments, get the code. First part put it in header, right after <body> and the <div> in single.php (single post template). Delete </div><?php comments_template(); ?></div> and add the one from facebook ;) Works perfect for me ;)

Plexiglas answered 14/2, 2012 at 20:54 Comment(0)
L
0

@gil-goldshlager, thanks for this workaround, I think a lot of developers are looking for this. I myself are struggling with this since a long time on one of my sites: sharemovi.es

I think most important thing you managed is to show old vs new comments side by side.

Unfortunately the yellow box still shows up in some instances, and some comments get lost consequently :

  1. OK: post after 12.15.2011 without comments (http://sharemovi.es/theprestige)

  2. OK: both post + comments after 12.15.2011 (http://sharemovi.es/biutiful)

  3. OK: both post + comments before 12.15.2011 (http://sharemovi.es/thesocialnetwork, http://sharemovi.es/battlelosangeles and http://sharemovi.es/thequickandthedead) - really nice to see those comments back!

  4. not OK: posts before 12.15.2011 without comments - 2 problems here:

a. yellow box with "Warning: this comments plugin is operating in compatibility mode, but has no posts yet. Consider specifying an explicit 'href' as suggested in the comments plugin documentation to take advantage of all plugin features."

b. the comments for those posts/pages that were made AFTER 12.15.2011 disappear (without comments: http://sharemovi.es/fromdusktilldawn, http://sharemovi.es/waiting, with comments - I checked moderation panel - http://sharemovi.es/ellesappelaitsarah and http://sharemovi.es/thegame )

All together, I get more comments now than before, so thanks again. However the yellow box is quite ugly, doesn't look professional. Very bad design decision from Facebook!

Hopefully you can look into this, I am happy to assist where possible.

Cheers Bob

Landlordism answered 3/3, 2012 at 16:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.