I've been having this problem since 7.x-1.0-rc6. The google +1 button is enabled for a page type and appears normally, but after a time stops appearing in the page's content. Clearing all caches fixes the problem temporarily as the button will immediately display as intended, but the issue re-occurs shortly thereafter. I updated to 7.x-1.0 hoping that would resolve the problem but it hasn't.

When inspecting the $content object during such times, the #markup property is blank:

[google_plusone] => Array ( [#markup] => [#weight] => 14 )

Some possibly relevant settings:

Display the button in these view modes:
Full content
Teaser

Weight
14

Include count?
Yes

Size
Medium (20px)

Optional wrapper with CSS
Blank (issue occurred with default values here, as well

Tag syntax
g:plusone

Comments

corbacho’s picture

There is no differences in the code that should affect from the rc5 version to 1.0 in your case.

It's really weird that it's present the [google_plusone] element in $content but not the #markup, because the only way possible is that the theme function is not being called.

In Drupal 7 has been implemented a new theme suggestion with double scores (see http://drupal.org/node/224333#theme_hook_suggestions_1 )

Could be that is not working properly?

Try to change the line 70:
'#markup' => theme('google_plusone_button__' . $node->type, $button_settings),
to
'#markup' => theme('google_plusone_button', $button_settings),

and tell me if there is any difference
Otherwise, I really don't have a clue what could be wrong. If the theme function is called ALWAYS should return a non empty string.

inharmonic’s picture

Sorry for the delay, I was waiting for this to re-occur (and of course, as soon as I finally posted an issue, it stopped right away). Nonetheless, I had the problem re-occur today. I changed the line of code as suggested and there was no change.

I did note that, at least this time, the was at least being rendered but not displayed. Again, clearing the cache solved the problem immediately.

ret5’s picture

Looks like disabling "cache blocks" on the performance page seems to resolve. Not ideal, but may be a quick fix.

corbacho’s picture

I set BLOCK_NO_CACHE in the Google+1 button block (in the code of the module)

So if you update to 7.1 it should be fixed, and you can enable again cache in blocks.

corbacho’s picture

Status: Active » Fixed

.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

corrected typo: accidentally wrote "#markup" as "#render"