Facebook "Like" button Facebook "Like" button
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Facebook "Like" button

Started by uk_martin, January 18, 2011, 03:35:22 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

uk_martin

Is it possible to use this plug-in here - http://forum.coppermine-gallery.net/index.php/topic,60893.0.html  as something that can be modified to show a Facebook "Like" button, instead of the "share" button?

I have tried this myself, by editing the codebase.php file like this:

find:
<a name="fb_share" type="button" href="http://www.facebook.com/sharer.php?u={$CONFIG['site_url']}displayimage.php?pid={$CURRENT_PIC_DATA['pid']}&t={$picture_title}">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
replace with:
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like show_faces="true" width="450"></fb:like>

In other words, using the script that Facebook provide.

It almost worked. The button installed, but when pressed, although it identified me, and said I "liked" the page, it also gave an error, saying that Facebook "couldn't get back to the page's URL" (or words to that effect)

If someone who knows more about the PHP that is in the codebase file could have a look, it may be a simple fix...I hope. It would be good to have a simple "Like" facility in these galleries.

Thanks in advance,

Martin
http://www.brummiesfans.com/photos/index.html


TeknoSounds

Theres a post in the share thread near the end that shows the code needed for a like button, though it can be gotten off the Facebook site too.  However the one in the thread will show you what you need to put for the URL and such.  Would suggest checking that out again.

uk_martin

This one? - http://forum.coppermine-gallery.net/index.php/topic,65740.40.html

I get another of those "nearly but not quite moments" from this. You can see here - http://www.brummiesfans.com/coppermine/displayimage.php?album=5&pid=42#top_display_media  - that this causes havoc with my theme (or any "Curve" based theme I'd guess).

Any way of getting the button on the side of the image (the one with the "thumbs up") to be the "active" one, and reposition it BELOW the image, and getting rid of the Plain Jane button that currently sits below the image? No need for two buttons, after all.

profili

You don't really need a plugin for this. Just open theme.php of your theme, then under the section // HTML template for intermediate image display of that file find this: {IMAGE}. (you can use ctrl-f to find it). And just under {IMAGE} add the Facebook like code from the Facebook social plugins page. That's all.

profili


TeknoSounds

right his code broke my template too...had to modify it a bit, play around with the <td> tags some

Can see it in action here:
http://teknosounds.com/tspics/displayimage.php?album=242&pid=27429#top_display_media

ended up using the facebook share plugin to add mine in there, changed in the codebase.php:
    $html .= <<< EOT
        <!-- Facebook share -->
<a name="fb_share" type="button" href="http://www.facebook.com/sharer.php?u={$CONFIG['site_url']}displayimage.php?pid={$CURRENT_PIC_DATA['pid']}&t={$picture_title}" target="_new">Share on Facebook</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script><br />
<iframe src="http://www.facebook.com/plugins/like.php?href={$CONFIG['site_url']}displayimage.php?pid={$CURRENT_PIC_DATA['pid']}&t={$picture_title};layout=standard&amp;show_faces=true&amp;width=350&amp;action=like&amp;colorscheme=dark&amp;height=35" scrolling="no" frameborder="0" align="middle"; style="border:none; overflow:hidden; width:350px; height:25px;" allowTransparency="true"></iframe></td>
EOT;

uk_martin

Thanks TechnoSounds, that's cured my problem too.  :)

Martin

TeknoSounds

Fantastic to hear! :D

Couple things about that code...  I changed "Share" to "Share on Facebook"....can be changed to whatever you wish
I also shrunk the like button iframe by 100 pixels.  Seemed to fit better.  If you play around with some table work, I'm sure you could get it to look nicer.

newx

Hey there,

please tell me, how to configure codebase.php.
I am new to 1.5 and i am not a php freak.
Can you tell us a step by step tutorial to get the buttons work?

Thx

NewX

papukaija

Quote from: newx on January 25, 2011, 12:38:46 AM
Can you tell us a step by step tutorial to get the buttons work?
1. Dowload the plugin referenced in reply 2.
2. Edit the plugin as described in reply 5.
3. Post a link to your gallery as requested by board rules if you need more specific instructions.

TeknoSounds

Quote from: papukaija on January 25, 2011, 01:12:37 AM
1. Dowload the plugin referenced in reply 2.
2. Edit the plugin as described in reply 5.
3. Post a link to your gallery as requested by board rules if you need more specific instructions.

yup exactly this.  Thanks again for everything papukaija!

newx

Hi there,

thx for the Info - works nearly perfect.

I have one additional question (not sure if i have to open a new thread)
The "Share" Button works, but it doesnt show the picture @facebook
as i saw, the guys above got it working.
Maybe you have clue to fix that problem.
Link to my galerie with share button: http://www.friseur-fragen.de/frisurengalerie/displayimage.php?album=110&pid=3324#top_display_media

TeknoSounds

Quote from: newx on January 25, 2011, 07:20:46 PM
Hi there,

thx for the Info - works nearly perfect.

I have one additional question (not sure if i have to open a new thread)
The "Share" Button works, but it doesnt show the picture @facebook
as i saw, the guys above got it working.
Maybe you have clue to fix that problem.
Link to my galerie with share button: http://www.friseur-fragen.de/frisurengalerie/displayimage.php?album=110&pid=3324#top_display_media

Probably need to move this request to the share thread...but if no one has it fixed up by tonight when I go into work I'll start working on it.  I think it'll be a simple fix.

newx

Hey Tekno,

thx - i also hope for a simple fix and wait for your advise before i post in "share"  Topic . .


Oenne

I have the same problem. The "Share" Button works, but it doesnt show the picture in den popup after clicking the share button and no photo on facebook.


TeknoSounds

Guys this isn't the topic for the share plugin, and after looking at it, I wasn't quite sure how to implement things, however there is a new FB plugin available that might contain everything we're looking for.  Checking it out now.