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.
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
- data-href: Use absolute URL of the page where comment box is used.
- data-num-posts: Shows how many comments will display by default. Minimum value should be 1.
- data-colorscheme: It is used for color coding. We can use two color code, ie. light and dark.
- 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.
- 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.
- 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.
- This plugin is very easy to use. It takes around 2 mins to configure in our website.
- 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.
-
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</>
- 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.
-
For more details see following link
https://developers.facebook.com/docs/plugins/comments/
No comments:
Post a Comment