Since I installed this module on a site, and enabled it for a particular content type ("blog"), and then clicked "Like" on a particular blog post to test, it seems that every new blog post is automatically displayed as "Like"d by me. This is only on the Drupal side, though -- my Facebook profile does not list "Like"s for each of the items. What could be going wrong?

CommentFileSizeAuthor
#2 fblikebutton-for-teasers.patch621 bytesnoelbush

Comments

noelbush’s picture

Okay, here's a clue: the duplicate "Like" status is only for teasers on the front page of the site. It doesn't occur when you look at an individual node's page.

noelbush’s picture

Status: Active » Needs review
StatusFileSize
new621 bytes

Here is the problem, very simple. Line 32 of fblikebutton.module, in fblikebutton_nodeapi(), sets $likepath to drupal_get_path_alias($_GET['q']). So, of course, when viewing the front page, this just gets the path to the front page, not whatever node is being rendered. Instead, it should be:

$likepath = drupal_get_path_alias($node->path);

This seems to work right now.

antiyouth’s picture

Thanks for posting this, noelbush. I'm running a backport of the module on Drupal 5 (I have to update an existing client's site), maybe that's the issue, but I'm not getting this to work, it still affects all the nodes on the page instead of the one that I clicked "Like" on. Not sure if this helps, but here's the a portion of my code with your replacement:

function fblikebutton_nodeapi(&$node, $op, $teaser, $page) {
global $user, $base_url;
$likebase = $base_url . '/';
$likepath = drupal_get_path_alias($node->path);
$webpage_to_like = $likebase . $likepath;

When I printed out $likepath, there was no value. Any thoughts/suggestions? Thanks in any case! I'll keep poking around, and if I figure it out, I'll post to here.

antiyouth’s picture

Okay, I tried something else.

Instead of:

$likepath = drupal_get_path_alias($node->path);

I tried this:

$likepath = url(drupal_get_path_alias( 'node/' . $node->nid));

Not sure if this passes Drupal muster, but at least on my test site, it seems like work like a charm. Thanks, wouldn't have gotten there without this thread.

antiyouth’s picture

fyi, here's the backport of the module for Drupal 5: http://drupal.org/node/1183632

jerdiggity’s picture

Assigned: Unassigned » jerdiggity
Status: Needs review » Active

This issue was resolved in the dev version... Will commit to next release as well.

dmsmidt’s picture

Status: Active » Closed (fixed)

New releases are out.
Marking as fixed.