Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Facebook Comments Box for Each Profile

Hello Guyz,

It may look nice if there's a Facebook Comments Box in each Member's Profile where Comments can be Posted by the FB Users.

DEMO : http://www.clan-icsl.com/profile.php?...p?lookup=1

1. Register your Application on Facebook and Keep your Required Information like Application ID, Application Secret etc etc with you(e.g in a TXT file)

2. Download the Cross Domain Receiver file from here and Upload it to the Root of your Website.

3. Backup your original profile.php first in a safe place and then Open profile.php. Go to the Line 200. You will Find a Closing Bracket }. i.e,

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false] echo "</tr>\n</table>\n</form>\n";
}
} // I am Talking about this Bracket[/syntaxhighlighter]

Just After this Bracket add this Code : http://pastebin.com/BpnkShf4
Code is in the Link. It was giving BB Code problem and converting smilies angry so had to pastebin it.

Replace XXXXXXXXXXXXXXX with your Application ID which is provided to you with your Application.

If you want to change How many Comments should be Displayed(Maximum), then change the numposts='10' to your needs.
If you want to change width, just change the width='400'

Last and Optional Step :

Open themes/templates/header.php and Find for this line :

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='".$locale['xml_lang']."' lang='".$locale['xml_lang']."'>\n";[/syntaxhighlighter]

Add the given below code after xmlns='http://www.w3.org/1999/xhtml' :

xmlns:fb='http://www.facebook.com/2008/fbml'

I called this Optional Step because the Comments will work without this step too. But I don't want to Break any Rules even by mistake pfft

Done !!!

Enjoy !!!

If you want to Customize the Text Color of Comment, or want to Customize the CSS related to it, you have to put an extra parameter named css where the code for :
echo "<fb:comments numposts='10' width='400' publish_feed='false' css='http://yourwebsite.com/fbcomment.css'></fb:comments>\n"; is defined

This will be a CSS file on your Server made by you...

Download the CSS file here : http://www.clan-icsl.com/includes/css...omment.css

Now Do whatever changes you want But Under Policies like changing Text Color.

Remember !!!

If you are changing the CSS the 2nd time(means you have been able to see the comment box once after you have installed your own CSS), then you have to change the CSS path in :
echo "<fb:comments numposts='10' width='400' publish_feed='false' css='http://yourwebsite.com/fbcomment.css'></fb:comments>\n"; also

There nothing much to do. Just change the File URL to something http://yourwebsite.com/fbcomment.css?1,http://yourwebsite.com/fbcomment.css?2,http://yourwebsite.com/fbcomment.css?3 everytime you make changes in your CSS !!!

This is because Facebook uses CACHE to Store CSS so it is required to change the file. In this way, it will not affect the real content .... wink

You should provide a Link to your Website's Terms of Agreement and a Link to your Website's Privacy Policy too...

> Better, Add the Code as a Lower Center panel with Display on All Pages

Code Updated below to the Updated version of Comments Box :

Add it as either Lower Center or Upper Center Panel : Remember to replace XXXXX with your APP ID or XID. In new Interface, Old Comments may Lost !

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]opentable("Comments via Facebook"wink;

$curlink = 'http://';
$curlink .= $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$curlink = urlencode($curlink);

echo "<table cellpadding='0' cellspacing='0' width='auto' class='center tbl-border'>\n<tr>\n";
echo "<td class='tbl2' colspan='2'><strong>Comments Box</strong></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl1'>\n";
echo "<div id='fb-root'></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'XXXXX', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'wink; e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root'wink.appendChild(e);
}());
</script>\n";
echo "<fb:comments xid='XXXXX' href='".$curlink."' numposts='5' width='auto' publish_feed='false' migrated='1'></fb:comments>\n";
echo "</td></tr>\n</table>\n";
closetable();[/syntaxhighlighter]

You can also Set the width according to your needs...
Push up.
Question: can it be done for photos, or maybe photoalbums?

Quote

structor wrote:
Question: can it be done for photos, or maybe photoalbums?


Yeah !!! Of course !!!

Actually, it uses the current page URL to show the Comments differently for each URL.

So wherever you put this code, it will show the comments posted n that page.

For example :

If the current page URL is www.clan-icsl.com/profile.php?lookup=1, then it will show the comments only for this URL... And similarly different comments posted for other URL's.

So in short comments are unique for all pages by url...

so you can use it in :

> Photo Albums Page
> Photos page
> Articles
> News
> Custom Pages

.
.
Infact on the whole site :P
So, I almost get it, but this part I didn't understood:

Quote

2. Download the Cross Domain Receiver file from here and Upload it to the Root of your Website.


There is an empty page on that link...

Quote

structor wrote:
So, I almost get it, but this part I didn't understood:

Quote

2. Download the Cross Domain Receiver file from here and Upload it to the Root of your Website.


There is an empty page on that link...


Ya its an empty page !!! But you have to Download it by Right Clicking on it and Save Link as or Save target as

It is somewhere written in the Policy of using Facebook Applications, so thats why you have to use it...
I am not familiar with facebook apps, so I must ask you: is it neccessary to make my own application?
Can't we use the application that you've made? (I have no idea what I have to do in the application form :) )
Yeah !!! Its necessary to make your own application as all applications are specific.

You cannot use my application because I have done settings to be used it on y URL.

Not much things you have to do !!! Just add the Website URL in Facebook for Websites in Application form :)
Thank you Ankur, it seems to work as it should ;)
;) Welcome !!!

Have you tried it somewhere ? Please post the Link if you don't mind B)
There's an error !!! You haven't made the Application correctly !!!

Have you entered the URL in ur application ???

Edit your Application by going to http://www.facebook.com/apps/applicat...4688468130 and clicking Edit App

Then Edit its App settings. In that, there will be an option saying Website. Enter your URL there !!!

------------------------
Edited :


Add the Domain URL to it, i.e http://www.modstruct.ro/

Not the link to photo !!!

And you have added in the code css='http://www.modstruct.ro/fbcomment.css', but the file doesn't exist !!!

Either remove it, or Upload the CSS file. Please read all the instructions carefully first which are given on the top post !!!
There are to lines:

Site URL: ....
Site Domain:....

On the second line I entered modstruct.ro
On the first what do I have to enter? Is this correct?

http://www.modstruct.ro/modele_case.php?photo_id=

Edit:
the file fbcomments.css is in place, it was on the beginning

Edit 2: oh sorry I wasn't payed attention, it is fbcomment, not comments :)
On the First line, i.e Site URl add http://www.modstruct.ro/ and Left the Second, i.e Domain blank as it is !!!

The Domain is for enabling if you want to use it on Subdomains of your website !!!!!

And either Upload the http://www.modstruct.ro/fbcomment.css css file or remove it from the code added in PHP file !!!!!!!

*************************************
EDITED :


Yeah !!! Good ! Its working now !!!!!!!
All done, works great :)

Quote

structor wrote:
All done, works great :)


Hmm ! ;)

You can use the same code on other things like articles etc...

also for customizing comments text, read about customizing css above in 1st post :)
just played a little in comments administration and it seems that the anonymous posting doesn't work.

I get the message: "unable to post on this wall", or something like that

Quote

Ankur wrote:
[quote]structor wrote:

so you can use it in :

> Photo Albums Page
> Photos page
> Articles
> News
> Custom Pages

.

Infact on the whole site :P


i want to add facebook comment box for each articles....but i dont know where line to add the http://pastebin.com/BpnkShf4 in articles.php
It's all postet by Ankur. And it is not usefull to qoute the complete posting.
Thread Information
Author
Replies
45 posts
Views
15,653 times
Last Post
Last updated on 9 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Harly, Structor, emilife93, l0nelyc0wboy, Jack Daniels, Rolf Mayer, Ankur