I am using the relatedlinks module to display a dynamic menu based on vocabulary and terms.

"Out of the box", relatedlinks.module displays the listing in an apparently random order. I would like to display the list in alphabetical order. I looked at the code, but didn't say where to change the order.

Has anyone done this?

Comments

pobster’s picture

I don't use it so this is a guess:

/**
 * Retrieve related links from the database.
 */
function _relatedlinks_get_links($nid, $type = NULL) {
  if (!isset($type)) {
    // The ORDER BY clause ensures that manually added links are given preference.
    $result = db_query('SELECT link FROM {relatedlinks} WHERE nid = %d ORDER BY TYPE DESC', $nid);
  }
  else {
    $result = db_query('SELECT link FROM {relatedlinks} WHERE nid = %d AND type = %d ORDER BY TYPE DESC', $nid, $type);
  }

  $links = array();

  while ($link = db_fetch_array($result)) {
    $links[] = filter_xss($link['link'], array('a'));
  }

  return $links;
}

Try changing the sql queries to 'ORDER BY link DESC'?

Pobster