Postponed
Project:
Google Plus One Button | Google+ Badge
Version:
7.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Dec 2011 at 08:41 UTC
Updated:
7 Jan 2012 at 20:53 UTC
Jump to comment: Most recent
Comments
Comment #1
ninjatalk commentedI am far from being capable of writing a patch so I have to hack the core with my limited knowledge. I have add this to line 124 of the .module file.
if($variables['node']->nid == 1) // my frontpage nid is 1
$url = url('', array('absolute' => TRUE));
I also changed the following "if" to "elseif".
Comment #2
corbacho commentedSorry for not replying before.
Yep, I see your pain there.
The problem is that not always the frontpage it's a node page. For example, the default frontpage is the "/node" path, that shows a list of published nodes (teasers)
Imagine that you set up the Google plus one module to show the g+1 button in the node teasers.
Using the function drupal_is_front_page in the hook_node_view always is going to return TRUE for all the nodes in the frontpage.
A solution would be comparing the path of the node with the frontpage path (taking consideration aliases issues, i18n issues) everytime a g+1 button is rendered, but it's overkill IMHO.
Another solution might be using this condition:
if (drupal_is_front_page() && !$teaser)But this is not covering all the cases, for example a edge case is when a module uses programmatically node_view() to show a node in the frontpage, etc
Conclusion: I don't know how to help in this case without bloating the module
I will mark as postponed by now.