Before you set up ShareThis!, it will print out a '0' at the very top of the page. This is because of a slight error in line 6 of the module. The fix is very simple, so I didn't roll a patch.

Line 6 should be changed from:

  if(drupal_set_html_head(variable_get('sharethis_sharethis_this_code', 0)) != 0) {

to

  if(variable_get('sharethis_sharethis_this_code', 0) != 0) {

That clears up the issue.

Comments

himerus’s picture

Okay, this is fixed in 1.3-3. http://drupal.org/node/302414

It was a dumb mistake... and I changed the condition to actually read the on/off switch in the module as the determination if to display the ShareThis code or not.

This means that the code should be inserted at the same time as when enabling the on/off switch.

function sharethis_init() {
if( variable_get('sharethis_type', 0) == 'sharethis_this') {
    drupal_set_html_head(variable_get('sharethis_sharethis_this_code', 0));
  }
}

I think this issue may fix the errors with duplicating shareThis items as well... it wasn't happening the first few times I tried it after upgrade.

himerus’s picture

Assigned: Unassigned » himerus
Status: Active » Closed (fixed)
ica’s picture

Oh.. thanks for the bugfix.. i was wondering where and how this "0" popped in the HEAD of the site and what caused it.. sharethis! "0" :)

Steven Merrill’s picture

Thanks for the prompt response - I'll download 1.3-3 now.

Steven Merrill’s picture

Status: Closed (fixed) » Active

I'm afraid the same thing still happens before configuring the module when using 6-1.3-3.

himerus’s picture

Crap... I'll take a look... I may need to physically uninstall the module for the test to properly work rather than just turning it off/on

fertoif’s picture

This worked for me, but obviously it does not solve the issue, only prevents the zero from messing up the head section.

<?php
function sharethis_init() {
if( variable_get('sharethis_type', 0) == 'sharethis_this') {
    if ( variable_get('sharethis_sharethis_this_code', 0) != "0") {
            drupal_set_html_head(variable_get('sharethis_sharethis_this_code', 0));
    }
  }
}
?>
greenskin’s picture

the variable_get('sharethis_sharethis_this_code', 0) should probably be changed to variable_get('sharethis_sharethis_this_code', '').

whitesun’s picture

I found that version 6.x-1.3-3 is also leading to the same problem. Disabling the module clears the '0' from the left top corner of the page. Otherwise this zero is very persistent. When the page is refreshed or a new link is clicked the zero persists.

This is very annoying and I hope a solution is posted soon.

Thanks

dave reid’s picture

dave reid’s picture

Version: 6.x-1.3-1 » 6.x-1.x-dev

Marking issue for 6.x-1.x since this is still not fixed in 6.x-1.3-1 and up.

robloach’s picture

Status: Active » Fixed

Checking if it's !empty() before printing it: http://drupal.org/cvs?commit=159316

Status: Fixed » Closed (fixed)

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