Facebook Like Mod

Started by Mick., May 13, 2010, 01:28:23 PM

Previous topic - Next topic

Mick.

Link to Mod

Facebook Like v.1.4
By BlueDevil

COMPATIBLE WITH SMF RC3 & RC4


Bug Fixes / Updates
1.) Created v.1.1 on April 23 2010
2.) Board permission support added April 24 2010
3.) Moved Like button to the post window December 2010
4.) Updated to RC4 December 2010



-This mod installs the Facebook "Like" button on every topic. When the Facebook user clicks on it, a link with title will be posted in the Facebook users Recent Activity wall.
-Board permissions also included.

NOTE***  Just like Facebook settings, you can only view the names of those you're friends with.

**Reply #2 has a couple php block add-ons for your portal



Pretty URL mod users

Open:
/Themes/default/Display.template.php

Find:
               <!-- Facebook Like Button -->
               <span style="float:right; margin-top:4px;">
                  <fb:like href=', $scripturl, '?topic=', $context['current_topic'], 'layout="standard" width="300" action="like" colorscheme="light" /></fb:like>
               </span>
               <!-- End of Facebook Like Button -->';


Replace with:
               <!-- Facebook Like Button -->
               <span style="float:right; margin-top:4px;">
                  <fb:like href="', $scripturl, '?topic=', $context['current_topic'], '" layout="standard" width="300" action="like" colorscheme="light" /></fb:like>
               </span>
               <!-- End of Facebook Like Button -->';


Mick.

#1
PHP blocks for your portal ;)   

*Replace yoursite.com in the code with your own domain.
*Adjust height & width to your likings
*Replace light for light themes or dark for dark themes.

Recent Activity:

The Activity Feed plugin displays the most interesting recent activity taking place on your site. Since the content is hosted by Facebook, the plugin can display personalized content whether or not the user has logged into your site. The activity feed displays stories both when users like  content on your site and when users share content from your site back to Facebook. If a user is logged into Facebook, the plugin will be personalized to highlight content from their friends. If the user is logged out, the activity feed will show recommendations from your site, and give the user the option to log in to Facebook.

The plugin is filled with activity from the user's friends. If there isn't enough friend activity to fill the plugin, it is backfilled with recommendations. If you set the recommendations param to true, the plugin is split in half, showing friends activity in the top half, and recommendations in the bottom half. If there is not enough friends activity to fill half of the plugin, it will include more recommendations.



// Facebook Recent Activity

echo '
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: \'\', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement(\'script\'); e.async = true;
    e.src = document.location.protocol +
      \'//connect.facebook.net/en_US/all.js\';
    document.getElementById(\'fb-root\').appendChild(e);
  }());
</script>

<div align="center"><fb:activity site="yoursite.com" width="170" height="300" header="true" colorscheme="light" /></fb:activity></div>';

//  End Of Facebook Recent Activity


Recommendations:

The Recommendations plugin shows personalized recommendations to your users. Since the content is hosted by Facebook, the plugin can display personalized recommendations whether or not the user has logged into your site. To generate the recommendations, the plugin considers all the social interactions with URLs from your site. For a logged in Facebook user, the plugin will give preference to and highlight objects her friends have interacted with.




// Facebook Recommedations

echo '
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: \'\', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement(\'script\'); e.async = true;
    e.src = document.location.protocol +
      \'//connect.facebook.net/en_US/all.js\';
    document.getElementById(\'fb-root\').appendChild(e);
  }());
</script>

<div align="center"><fb:recommendations site="yoursite.com" width="170" height="300" header="true" colorscheme="light" /></fb:recommendations></div>';

//  End Of Facebook Recommendations



Comments

The Comments Box easily enables your users to comment on your site's content — whether it's for a web page, article, photo, or other piece of content. Then the user can share the comment on Facebook on their Wall and in their friends' streams.

To be used in PHP articles and/or pages.



// Facebook Comments

echo '
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: \'\', status: true, cookie: true,
             xfbml: true});
  };
  (function() {
    var e = document.createElement(\'script\'); e.async = true;
    e.src = document.location.protocol +
      \'//connect.facebook.net/en_US/all.js\';
    document.getElementById(\'fb-root\').appendChild(e);
  }());
</script>

<div align="center"><fb:comments></fb:comments></div>';

//  End Of Facebook Comments

gietl

First off, thanks for the modification.

So without looking at the code, is this just implementing the simple iframe that passes in a URL?  Any chance it will support application id's, use the js sdk and support open graph meta data? I know I know a lot of questions.

I have just been unwilling to tackle the more detailed approach myself. :D

Mick.

Quote from: gietl on May 13, 2010, 04:15:22 PM
First off, thanks for the modification.

So without looking at the code, is this just implementing the simple iframe that passes in a URL?  Any chance it will support application id's, use the js sdk and support open graph meta data? I know I know a lot of questions.

I have just been unwilling to tackle the more detailed approach myself. :D

It does not uses the iframe code.  It uses js sdk.

For open graph data, im looking into it;)


~DS~

So I have to choose either this or SA FB Connect because the like button wont show up with both of it installed.
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

Mick.

Quote from: Dismal Shadow on May 13, 2010, 04:36:40 PM
So I have to choose either this or SA FB Connect because the like button wont show up with both of it installed.

I dont use the SA's mod or seen it in action.  It does work fine with smf-media's facebook connect mod tho'.

Liam.

Quote from: Dismal Shadow on May 13, 2010, 04:36:40 PM
So I have to choose either this or SA FB Connect because the like button wont show up with both of it installed.

Which is why the gods brought us Parse, so we can manually install it - and having the source code here so we can look into why it doesn't work ;) I use SAFBC though, and want to use this aswell - so will most likely look into it myself...

Great mod though, glad it got accepted ;)

~DS~

Quote from: bluedevil on May 13, 2010, 04:42:05 PM
Quote from: Dismal Shadow on May 13, 2010, 04:36:40 PM
So I have to choose either this or SA FB Connect because the like button wont show up with both of it installed.

I dont use the SA's mod or seen it in action.  It does work fine with smf-media's facebook connect mod tho'.
Because it doesn't have "share" button like smf-media's facebook does?
"There is no god, and that's the simple truth. If every trace of any single religion were wiped out and nothing were passed on, it would never be created exactly that way again. There might be some other nonsense in its place, but not that exact nonsense. If all of science were wiped out, it would still be true and someone would find a way to figure it all out again."
~Penn Jillette – God, NO! – 2011

Mick.

Quote from: Dismal Shadow on May 13, 2010, 05:21:52 PM
Because it doesn't have "share" button like smf-media's facebook does?

Right.  smf-media's is just a connect.

Mick.

Reply #2 has some php blocks for your portal ;)

gietl

Quote from: bluedevil on May 13, 2010, 04:25:08 PM
Quote from: gietl on May 13, 2010, 04:15:22 PM
First off, thanks for the modification.

So without looking at the code, is this just implementing the simple iframe that passes in a URL?  Any chance it will support application id's, use the js sdk and support open graph meta data? I know I know a lot of questions.

I have just been unwilling to tackle the more detailed approach myself. :D

It does not uses the iframe code.  It uses js sdk.

For open graph data, im looking into it;)



Great, thanks for the response! Since it is using the sdk, do we have a place to enter our app_id in the admin interface?

The challenge on the meta tags will be:

Ensure your forum is using the URL structure you want, because after 10 likes it's "permanent."  Along with that, I'm certain FB will be expanding their categories.

Thanks again for releasing this and the continued work. Also, well done sight for the Avalanche club.

Afro

Another great one.. You guys Rock...

Mick.

Quote from: gietl on May 14, 2010, 03:52:31 PM

Great, thanks for the response! Since it is using the sdk, do we have a place to enter our app_id in the admin interface?

The challenge on the meta tags will be:

Ensure your forum is using the URL structure you want, because after 10 likes it's "permanent."  Along with that, I'm certain FB will be expanding their categories.

Thanks again for releasing this and the continued work. Also, well done sight for the Avalanche club.

Yes, in fact last night i made v.1.3 with all your suggestions.   Meta's, app id's, etc.

Im testing it at my site to see if in fact is working.

Mick.


mirahalo

Nice mod ;)  and nice blocks ;)


Quote from: Dismal Shadow on May 13, 2010, 04:36:40 PM
So I have to choose either this or SA FB Connect because the like button wont show up with both of it installed.

yes, currently the SA FB connect still works with the old facebook script, unfortunately  you need to remove any old facebook code before you can use facebook JavaScript SDK, otherwise it won't work.

Mick.

Quote from: 130860 on May 14, 2010, 04:13:06 PM
Nice mod ;)  and nice blocks ;)


Quote from: Dismal Shadow on May 13, 2010, 04:36:40 PM
So I have to choose either this or SA FB Connect because the like button wont show up with both of it installed.

yes, currently the SA FB connect still works with the old facebook script, unfortunately  you need to remove any old facebook code before you can use facebook JavaScript SDK, otherwise it won't work.

Thanx bro....

You know? I was thinking about that yesterday.  When i started writing the mod, i knew facebook's js sdk just came out and wondered if SA's mod was up to date since he released it way before facebook did their js sdk.

Thanx for verifying it.  I should've looked at his code i guess.

Afro

BD, if about 10 people click on the "like" button,
are they all supposed to be listed near the button ?

Mick.

Quote from: Afro on May 14, 2010, 06:47:13 PM
BD, if about 10 people click on the "like" button,
are they all supposed to be listed near the button ?

Only if you know them by name.  But it should show "10 people like this".   Since its being hosted from facebook, not always show.

Sudhakar Arjunan

Good Work Bluedevil.

I was a big fan of chevyavlanche club.

Maintained perfectly, Good Theme too.

Facebook Like Mod is so essential for social exchange. Thank you and will give a try today.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

Mick.

Quote from: A.SK on May 14, 2010, 07:15:32 PM
Good Work Bluedevil.

I was a big fan of chevyavlanche club.

Maintained perfectly, Good Theme too.

Facebook Like Mod is so essential for social exchange. Thank you and will give a try today.

Thanx brother.    Try it. ;)

Advertisement: