Is there a way to reload the page after <fb:like> is clicked?
Posted
by
joon
on Stack Overflow
See other posts from Stack Overflow
or by joon
Published on 2011-02-12T15:13:05Z
Indexed on
2011/02/12
15:25 UTC
Read the original article
Hit count: 217
Hi, I'm wondering about this: I have a simple facebook-connect app that will only show certain content after you login and liked a certain page. It works (huzzah!) but I want to make it more user friendly by making it refresh automatically after you pressed the like button.
Here's some code:
<?php
if ($me) {
$pageid = -----------;
$uid = $me['id'];
$likeID = $facebook->api(
array( 'method' => 'fql.query', 'query' =>
'SELECT target_id FROM connection WHERE source_id = ' . $uid . ' AND target_id = ' . $pageid )
);
if ( empty($likeID) )
{
// Person is LOGGED IN, but has NOT LIKED
echo '<script src="MY WEBPAGE"></script><fb:like href="MY WEBPAGE" layout="box_count" show_faces="false" width="450"></fb:like>';
}
else
{
// Person is LOGGED IN, and has LIKED, score!
echo 'Download link';
}
}
else
{
// Person is NOT LOGGED IN, so we know NOTHING
echo '<script src="MY WEBPAGE"></script><fb:like href="MY WEBPAGE" layout="box_count" show_faces="false" width="450"></fb:like>';
} ?>
Is there anything I can do to this code (maybe in the fb:like tag?) that makes it reload the page after a like?
Thanks.
© Stack Overflow or respective owner