I've switched to the Category module and everything went OK, untill I've noticed, that some related links listed below the nodes with categories (at least one) assigned are doubled. After some investigation I've found out that it is always the last related link, that is listed twice.

It doesn't matter, if it is a category imported from previous taxonomy structure or new one. I've also tried to delete the category and insert it again, but this did not help.

It's always the last one listed -- when I assign yet another category to the node and that new category is listed at the end of the related links, it is displayed twice instead of the previous one.

I hope I'm clear enough :-)

Marek

Comments

venkat-rk’s picture

This is a bug that was introduced when a patch was added to make category provide better integration with the views module. I think it will remain until Jaza or anyone else can make another patch that takes care of this.

In the meanwhile, you can uncheck the 'display links to categories on assigned nodes' in the category_display settings of your container to avoid this.

vatavale’s picture

Priority: Normal » Critical
chrislynch’s picture

Not a genuine fix, but you can work around this temporarily in your theme in a safe way that will not lose any links if and when you patch your site with the fix to this bug.

From my adapted sands theme:

function sands_links($links, $delimiter = '')
{
  if (!is_array($links)) {
    return '';
  }

  /* Maps a link to it's associated class */
  $link_to_id = array(
    t('edit') => 'edit',
    t('delete') => 'delete',
    t('Add a new comment to this page') => 'add-comment',
    t('Share your thoughts and opinions related to this posting') => 'add-comment',
    t('Jump to the first comment') => 'comment',
    t('reply') => 'reply',
    //t('read more') => 'read-more',
    t('printer-friendly version') => 'print',
    t('add child page') => 'add-child-page',
    t('calendar') => 'calendar',
  );

  $new_links = array();
  $new_links[] = '';
  $old_link = '';
  foreach ($links as $link) {
    if (! $old_link == $link)
    {
	foreach ($link_to_id as $text => $id) {
	if (strpos($link, $text)) {
		$link = str_replace('<a ', "<a class=\"icon-$id\" ", $link);
		break;
	}
	}
	$new_links[] = '' . $link . '<img src="files/bullet.gif" align="middle">';
	$old_link = $link;
    }
  }

  return implode($delimiter, $new_links);
}

This checks each link against the previous one and removes any duplicates. As it only seems to be the last link the chain that is duplicated, this removes it automatically. When the category module stops producing the extra link, this change will simply do nothing (as there will be no dupes) and be removed for efficiency or harmlessly left in place.

chrislynch’s picture

Doh - previous block of code actually took out non-dupes from the end as well. Here's a better version for anyone still wanting links

function sands_links($links, $delimiter = '')
{
  if (!is_array($links)) {
    return '';
  }

  /* Maps a link to it's associated class */
  $link_to_id = array(
    t('edit') => 'edit',
    t('delete') => 'delete',
    t('Add a new comment to this page') => 'add-comment',
    t('Share your thoughts and opinions related to this posting') => 'add-comment',
    t('Jump to the first comment') => 'comment',
    t('reply') => 'reply',
    //t('read more') => 'read-more',
    t('printer-friendly version') => 'print',
    t('add child page') => 'add-child-page',
    t('calendar') => 'calendar',
  );

  $new_links = array();
  $new_links[] = '';
  $old_link = '';
  foreach ($links as $link) {
    watchdog('DEBUG',strpos($old_link,$link));
    if (is_numeric(strpos($old_link,$link)))
    {
        // This is a duplicate link
    }
    else
    {
	foreach ($link_to_id as $text => $id) {
	if (strpos($link, $text)) {
		$link = str_replace('<a ', "<a class=\"icon-$id\" ", $link);
		break;
	}
	}
	$new_links[] = '' . $link . '<img src="files/bullet.gif" align="middle">';
    }
    $old_link .= $link;
  }

  return implode($delimiter, $new_links);
}
bdragon’s picture

Status: Active » Closed (duplicate)

Marking as duplicate of
http://drupal.org/node/74629

Please watch that issue for updates.

Thank you for your patience.
--Brandon