Current status of the Ning Platform is always available on the Ning Status Blog.

FORUM

NC for Hire

If you are looking for a way to import all comments on a post from facebook into your Ning network, here is a trick you may have not tried.  Of course you can grab an embed code from Facebook and embed the actual post into your site, but this is quite different.

Add the Following CSS to your Design Studio:

.entry-content {
width:500px;
margin:0 auto;
}

.embed-fb-comments {
text-align:left;
margin-top:20px;
}

.entry-content .ufithumb {
width:32px;
height:32px;
display:block;
border:none;
vertical-align:top;
}

.ufithumblnk {
display:block;
}

.ufithumbwrap {
float:left;
}

.clearfix:after {
clear:both;
content:".";
display:block;
font-size:0;
height:0;
line-height:0;
visibility:hidden;
}

.entry-content .UFIRow {
background-color:#fafbfb;
border:0;
margin:1px 0 0;
padding:6px;
}

.UFIImageBlockContent {
margin:0;
padding:0 0 0 8px;
overflow:hidden;
}

.UFICommentContentBlock {
position:relative;
}

.entry-content .UFICommentContent {
font-family:Helvetica, Arial, 'lucida grande',tahoma,verdana,arial,sans-serif;
font-size:12px;
line-height:1.28;
}

.entry-content a {
font-weight:700;
color:#3b5998;
text-decoration:none;
}

.fb-out {
clear:both;
display:block;
text-align:right;
font-size:11px;
}

///and optionally///

@import url(http://fonts.googleapis.com/css?family=Lato);
html, body {
padding: 0;
margin: 0;
height: 100%;
text-align:center;
color:#555;
font: 1em/1.5 "Lato", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizelegibility;
background:#eee
}

Add the Following Javascript to your Custom Code End of Page:

<script>

var comment = x$('.embed-fb-comments');
var postId = comment.attr('data-post-id');
//you will need the div with attribute data-post-id
//You can also make this get the ID from the fb embed post element, doesnt quite work on codepen
jQuery.getJSON('https://graph.facebook.com/'+ postId +'/comments', null, function(data){
//Cache this if you can
for (obj in data.data) {
var item = data.data[obj];
var itemRow = FbMakeCommentRow(item);
comment.append( itemRow );
}


});




function FbMakeCommentRow(object){
var row = '<div class="UFIRow clearfix">'+ "\n" +
'<div class="ufithumbwrap">'+ "\n" +
' <a href="http://facebook.com/profile.php?id='+ object.from.id +'" class="ufithumblnk">'+ "\n" +
' <img class="ufithumb" src="http://graph.facebook.com/'+ object.from.id +'/picture?type=square" />'+ "\n" +
' </a>'+ "\n" +
'</div>'+ "\n" +
'<div>'+ "\n" +
' <div class="clearfix UFIImageBlockContent ">'+ "\n" +
' <div class="UFICommentContentBlock">'+ "\n" +
' <div class="UFICommentContent">'+ "\n" +
' <a href="http://facebook.com/profile.php?id='+ object.from.id +'" class="UFICommentActorName">'+ "\n" +
object.from.name + "\n" +
' </a>'+ "\n" +
' <span class="UFICommentBody">'+ "\n" + object.message.nl2br() + "\n"
' </span>'+ "\n" +
' </div>'+ "\n" +
' </div>'+ "\n" +
' </div>'+ "\n" +
'</div>'+ "\n" +
'<div class="clearfix"></div>'+ "\n" +
'</div>';
return row;
}

if(window.location.href.indexOf("full") == -1){
x$(".link-out").click(function(e){

e.preventDefault();
window.open( 'https://m.facebook.com/'+x$('.embed-fb-comments').attr('data-post-id'), '', 'width=600,height=300' );

return false;

});
}
String.prototype.nl2br = function()
{
return this.replace(/\n/g, "<br />");
}

</script>

Now the Magic is in the HTML:  [Replace the RED with the id of the post you are embedding comments from]

<div class="entry-content">
<a href="#" class='link-out' target="_b">Try it now</a>, your comment will display below
<div class="embed-fb-comments" data-post-id="10153751224522586"></div>
<!--The Post ID where the comments are kept--><br>
<a href="#" class="fb-out link-out" target="_b">Post a comment</a>
</div>

You get your post id by right clicking on the post and getting the url which looks something like this:

https://www.facebook.com/media/set/?set=a.10153751224522586.1073741832.41140237585&type=1

the part immediately after the a. is the id

Try it out here on my sandbox

You need to be a member of Ning Creators Social Network to add comments!

Join Ning Creators Social Network

Email me when people reply –

Replies

  • Hello JFarrow, this is awesome. I hope you don't mind but I did tweak your code slightly. It was nonresponsive and when you got down to smaller cell phone views , a white background would show up. I fix those two issues and now the code will work in Ning2 and Ning3. Always place the HTML in your widest column.
    Your CSS and JavaScript are in this one line of code.  Like I said, your code is awesome

    <!-- JFarrow_Embed_Facebook_Comments -->
    <!--N3 Custom Code - End of Page Code box -->
    <!--N2 NC Custom Code box -->
    <script src="https://api.ning.com/files/*54juLYOTrN-*GMOAMFN2PDyyqmK3SAXlnmcELTvJyQDvzJrm3GqZkkMO1aQHNHWJGBx3RC8JPBFwAKZXuJ5nP60PBBNGG1v/JFarrow_Embed_Facebook_Comments.js"></script>

    • The HTML goes into any HTML box on a Ning3 network. Ning2 the code goes in a text box.

      • NC for Hire

        nice work George... i just threw this up with the intention of doing exactly what you did... so i thank you..

        • It's such a nice code I had to do it. You're welcome and thank you for sharing. :)

      • Hi George, Can you possibly help me add this to my site?  

        Thanks, Suzie

This reply was deleted.

Announcements

 

Some interesting articles related to community management, digital marketing etc. could be found in our digest. Don't hesitate to leave a feedback so we would know that we should continue :-)

Latest Activity

Grace Shaki, Martin, Git Along and 16 more joined Ning Creators Social Network
5 hours ago
Kos replied to Suzie Nielsen's discussion
How to hold a Contest? Thumbs up- on 2.0
"It's been a year.  Has anyone come up with a thumbs up/down script?????"
19 hours ago
Fabricio Giugni posted a discussion
Hi there,  Can we integrate the Builderall with Ning? The only thing I want from Ning is the abilit…
Saturday
Fabricio Giugni replied to Fabricio Giugni's discussion
How can I add video from Youtube on landing page?
"Hi,
    Thanks, it did work. But I will create this page in some other place. I spend a Thousand do…"
Saturday
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion
TRICK: Host Your External CSS and JS Files using Dropbox
"I no longer use Dropbox for this...   I use Github....  ask me how if it is too complicated for you…"
Friday
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion
Create a More Exciting "Featured" Email With Language Editor

still one of the most powerful tools and one of the first things I change when I start a new comm…"
Thursday
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion
How to Give Your Ning a Really Fake Voice
"These days I use Speakpage and it provides a great on the fly service, but it is limited to a singl…"
Thursday
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion
How to Create Search Feeds in Bing with a Simple Hack
"thank you brother"
Thursday
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion
How-to Control Number of Member Profiles on Member Page Using CSS
"Wow... just look how active Creators used to be!"
Thursday
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion
You May Not Know This About Facebook
"this tip worked well for me today again"
Thursday
⚡JFarrow⌁ replied to ⚡JFarrow⌁'s discussion
Linkedin Tip: Export Your Contacts For Import Into Ning
"yes it most definitely does work on both"
Thursday
⚡JFarrow⌁ updated their profile
Thursday
More…

Meanwhile, you can check our social media channels