facebook button & dynamic meta tags adding to login page facebook button & dynamic meta tags adding to login page
 

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 button & dynamic meta tags adding to login page

Started by grantson, June 21, 2010, 03:49:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

grantson

Hi Guys

nearly have this working now just need one final piece of the puzzle

gallery is here www.magicmirrorphoto.co.uk/gallery

I now have the meta tags in place on teh displayimage.php page and all works as it should if the gallery is freely browsable
when I set guest users to only be able to see thumbnails the share button gets the correct link but displays magicmirror-login as the page title and does not pick up the thumbnail

what i some help with is knowing which bit of login.php to add the code to inject the meta tag and also how to convert the path to the image from the pid

as always any assistance greatly appreciated

Joachim Müller

Use a plugin to inject the meta tag into each and every page. Editing all core files is baaaaad. The proper plugin hook would be page_meta. Post what you have got for details if you need help. Posting a reference to the facebook api specs might help as well.

grantson

Thanks Joachim

the facebook button uses a link www.facebook.com/share.php?u=<url>
then scans teh page for 3 meta tags to fill out its info

<meta name="title" content="title" />
<meta name="description" content="description " />
<link rel="image_src" href="thumbnail_image" / >

i will have a read through the plugin documentation (& probably php manuals) and see what i can do

grantson

well after all that it doesnt work anyway

I was eventually able to add a couple of lines to joe's custom descriptions plugin which added the 3 lines (statically for a test image admittedly) but alas when I click the button it just posts a link to the login page :(

back to the drawing board

grantson

Ahha, breakthrough

create a page with the meta tags in the header & then a meta redirect tag

<head>
<meta http-equiv="Pragma" content="no-cache" />
<meta name="title" content="<?php echo $pgTitle ?>" />
<meta name="description" content="<?php echo $pgDesc ?> " />
<link rel="image_src" href="<?php echo $thumbUrl ?>" />
<meta HTTP-EQUIV="REFRESH" content="0; url=<?php echo $redirectUrl ?>">
</head>


sofar have only tested this with statically assigned info but facebook picks up the correct title and thumbnail
when the link is clicked the user is redirected to the login page and then to the correct image

I have been studying the display image.php page but am at a loss as to how the Current_Pic_Data[] array is filled
is there a function that does this or do i need to manually populate variables from the database using mysql queries

I cant belive something that looked so simple on the outset is frying so many braincells  ???

Joachim Müller

Why don't you post a link to the facebook API for a start...

grantson

im going by the list of required meta tags from the developer wiki page

http://wiki.developers.facebook.com/index.php/Facebook_Share/Specifying_Meta_Tags

as I say i now have a partial solution which works but in order to make it dynamic i need to know how to populate the $CURRENT_PIC_DATA[]
so that i can pass the pid as a variable to the intermediate page.


papukaija

Quote from: Joachim Müller on June 22, 2010, 03:55:04 PM
Why don't you post a link to the facebook API for a start...

And why not test the Facebook plugin from the cpg1.4 board? You probably just need to edit the plugin's configuratione.php to get rid of the version number warning. Details about the edit here and here.

grantson

Thats what I have done
ive been tweeking it to get it to work properly

ie post a link to the gallery page instead of direct to the image which is what that one does

guess im just going to need to write a php script to query the coppermine database

Joachim Müller

Quote from: papukaija on June 23, 2010, 02:30:01 PMYou probably just need to edit the plugin's configuratione.php to get rid of the version number warning.
That's bad advice. If things were that easy, we wouldn't have bothered to come up with the version warning in the first place. Every non-trivial plugin needs to be re-written and will not work by just manipulating the version checking routine.

There already is a twitter plugin for cpg1.5.x: flf_zwitscher - Twitter plugin for coppermine

grantson

solved :)

link button points to a new page called shareout.php

shareout.php is populated with dynamic metas and then redirets to displayimage.php

see here :)
http://forum.coppermine-gallery.net/index.php/topic,65697.0.html