The Linux Page

AddThis is down, how to prevent the slow download of your pages?

Today AddThis is down, big time! For hours...

So to make my websites load faster (although I did not delete all the caches, which is a problem too?!) I removed the functionality. If you have Drupal, there is what I have done to leave the settings the same but still hide the AddThis button and thus get all the pages of all my websites to load fast.

First we remove the link by returning an empty array:

/**
 * Implementation of hook_link(). 
 */
function addthis_link($type, $node=NULL, $teaser = FALSE) {
return array(); // immediate return
  $links = array();

  if ($type === 'node' && user_access('view addthis')) {
    if (($node && variable_get('addthis_nodetype_' . $node->type, 1)) &&
      (($teaser && variable_get('addthis_display_in_teasers', '0')) ||
      (!$teaser && variable_get('addthis_display_in_links', '0')))) {
      $links['addthis'] = array(
          'title' => _addthis_create_button($node, $teaser),
          'html' => TRUE,
        );
    }
  }

  return $links;
}

And to hide the block (which I use most of the time because it also shows up on Views, etc.) I comment out the part that generates the block output:

/**
 * Implementation of hook_block().
 */
function addthis_block($op = 'list', $delta = 0) {
  if ($op == 'list') {
    $blocks[0]['info'] = t('AddThis button');
    return $blocks;
  }
  //elseif ($op == 'view' && user_access('view addthis')) {
  //  $block['subject'] = t('AddThis');
  //  $block['content'] = _addthis_create_button();
  //  return $block;
  //}
}

That's it.

Pingback

[...] information on how to accomplish what I've done to temporarily remove AddThis, check out my Linux Page post. Alexis Wilke's [...]