Love this module but I had problems getting it to display in blocks.

I thought I would record everything I did as an aid in case others are having the same problem.

I wanted to display the bookmarks in the footer region of every page on my site, which includes nodes, taxonomy term pages and panel pages.

1. Set block visibility to "display on all pages except admin*" (didn't want it showing on admin pages)
2. On admin/settings/sexybookmarks, un-ticked all Content types (didn't want it showing as part of the content as it was going to be in the footer region)
3. On admin/settings/performance, disabled Block Cache (don't know why this was necessary but it was. Without doing this, the block showed for the first time only)
4. Edited sexybookmarks.module as follows:-

From

function sexybookmarks_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      return array(
        array(
          'info' => t('SexyBookmarks'),
        ),
      );

    case 'view':
      if (arg(0) == 'node' && is_numeric(arg(1))) {
        $settings = _sexybookmarks_get_settings();
        $node = node_load(arg(1));
        if (_sexybookmarks_display($settings, $node, array('block' => TRUE))) {
          return array('content' => theme('sexybookmarks', $node));
        }
      break;
  }
}

to

function sexybookmarks_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      return array(
        array(
          'info' => t('SexyBookmarks'),
        ),
      );

    case 'view':
      if (arg(0) == 'node' && is_numeric(arg(1))) {
        $settings = _sexybookmarks_get_settings();
        $node = node_load(arg(1));
        if (_sexybookmarks_display($settings, $node, array('block' => TRUE))) {
          return array('content' => theme('sexybookmarks', $node));
        }
      } elseif (arg(0) != 'node') {
	    return array('content' => theme('sexybookmarks', $node));
      }
      break;
  }
}

and from

function _sexybookmarks_display($settings, $node, $type) {
  if ($settings['display']['types'][$node->type] !== 0) {
    // Display in node.
    if ((isset($settings['display']['location']['above']) && $settings['display']['location']['above'] != FALSE) || (isset($settings['display']['location']['below']) && $settings['display']['location']['below'] != FALSE)) {
      // Display in teaser.
      if (isset($type['teaser']) && $type['teaser'] && $settings['display']['node'] != 1) {
        return TRUE;
      }

      // Display in page.
      if (isset($type['page']) && $type['page'] && $settings['display']['node'] != 0) {
        return TRUE;
      }
    }

    // Display in block.
    if (isset($type['block']) && $type['block']) {
      return TRUE;
    }
  }
 
  return FALSE;
}

to

function _sexybookmarks_display($settings, $node, $type) {
  if ($settings['display']['types'][$node->type] !== 0) {
    // Display in node.
    if ((isset($settings['display']['location']['above']) && $settings['display']['location']['above'] != FALSE) || (isset($settings['display']['location']['below']) && $settings['display']['location']['below'] != FALSE)) {
      // Display in teaser.
      if (isset($type['teaser']) && $type['teaser'] && $settings['display']['node'] != 1) {
        return TRUE;
      }

      // Display in page.
      if (isset($type['page']) && $type['page'] && $settings['display']['node'] != 0) {
        return TRUE;
      }
    }

    // Display in block.
    if (isset($type['block']) && $type['block']) {
      return TRUE;
    }
  }

  else {
    // Display in block.
    if (isset($type['block']) && $type['block'] != FALSE) {
      return TRUE;
    }
    else return FALSE;
 
  } 

  return FALSE;
}

Comments

deciphered’s picture

Status: Active » Fixed

Blocks have been improved in 6.x-2.x/7.x-2.x and the block caching issues has been resolved (in dev). Stable releases coming shortly.

Status: Fixed » Closed (fixed)

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