facebook comment box

How to use facebook comment box in your website?

Facebook comment box can be used any where either in blog, tutorial or others. People can comment using their facebook profile. Comments can be seen in friend's news feed.

Use following code for it.

Copy-paste following code after start of <body>
<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"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>

Copy-paste following code where you have to use comment box in your website.
<div class="fb-comments" data-href="http://www.fbchandra.com" data-num-posts="5" data-colorscheme="light" data-order-by="social" data-mobile="1" data-width="550"></div>

Explaination of attributes
  1. data-href: Use absolute URL of the page where comment box is used.
  2. data-num-posts: Shows how many comments will display by default. Minimum value should be 1.
  3. data-colorscheme: It is used for color coding. We can use two color code, ie. light and dark.
  4. data-order-by : Order can be used in three ways
    a. social - Used by default. It is used to order all relevant comments from friends and friends of friends as well as most liked comments.
    b. time - Comments are displayed according to time. ie. first posted comment will come first and newest comments will go last.
    c. reverse_time - Newest comment will show in top and oldest comment will show in bottom.
  5. data-mobile: It is auto detected by default. We have to use boolean value ie. '1' or '0'. '1' is used if we have to use it for mobile version and '0' if only for web.
  6. data-width: It is used to fix plugin width. By default it uses 550px as width. For mobile version it uses 100% as width.
It has many inbuilt features.
  1. This plugin is very easy to use. It takes around 2 mins to configure in our website.
  2. It has inbuilt moderation tools. Moderation tools is used when admin want to delete some comments. Admin donot want to display all comments. Admin has two type of rights. They can mark comments as 'visible to everyone' and 'require approval before being visble to everyone'. By default it is seen only by commenter and their friends.

    Admin can disallow certain words and ban certain users to comment.

    To become an admin we have to open graph meta tags. These tags are included in of file.
    <meta property="fb:admins" content="{Your facebook user id}" />
    To add multiple moderator, we have to use all in different rows.
    <meta property="fb:admins" content="{Facebook user id of first}" /> <meta property="fb:admins" content="{Facebook user id of second}" />

    If our site has multiple comment box and multiple admin to moderate comment, it is recommended to create an app and use that app id for moderation. All admin of that app can moderate comments. Use following tag in head.
    <meta property="fb:app_id" content="{Your application id}" />
    If you have multiple comment box and use app id as an admin for moderation, then all comment box use same setting ie. either visible to all or limited visibility.
    If you want some to be visble to all and some with limited visibility then you have to create two app and then you have to make setting according to it.
    Moderation tools can be used using below link. <a href="https://developers.facebook.com/tools/comments"> https://developers.facebook.com/tools/comments</a>
    Note:You must be be registered as developer to use moderator tool.

  3. You can easily know when someone comment on your site. You have to subscribe 'comment.create' and 'comment.remove' events in Facebook SDK for it. For details use following link <a href="https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe"> https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe</>

  4. You can see the count of comments and shares used for given URL. We can use graph API to know the number of comments. Use following URL for it.
    https://graph.facebook.com/?ids=http://www.fbchandra.com/
    Also fb:comments-count can be used to show number of comments.
  5. User can post using other login providers like gmail, Yahoo etc.
  6. For more details see following link
    https://developers.facebook.com/docs/plugins/comments/
#Gorgeous
By Abhi HalDar at 2017-03-06 13:23:14
#Gorgeous
By Abhi HalDar at 2017-03-06 13:23:13
www.room-rent.in
By randheer at 2016-01-26 14:03:49
www.room-rent.in
By room rent at 2016-01-26 14:03:08
Name
Email
Comments
Back
Funding

We need your support to operate it properly. We have lots of ideas but less fund, so help us with your funding.

Thoughts for the day

If A is a success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut.

Albert Einstein
Polls
Which device you use most for facebook application?
Laptop/PC
25%

 


Android
50%

 


IOS
16%

 


Blackberry
9%

 


Tutorial On Request
Q. Ask us for any tutorial or any thing which helps to build your career better.
Email:
Query: