Hi,

There are lots of options in "Find nodes by this field:", which is really great. But I want to find a node by its node ID (NID). When the user enters the node id of a node, he goes directly to that node. Is it possible?

Thanks...

Comments

danielb’s picture

Status: Active » Fixed

The Finder module is a continuation of this project that supports such features.

Sinan Erdem’s picture

Unfortunately I need a solution for Drupal 5, and Finder doesn't give support for D5.

So... no way for this??

danielb’s picture

You posted this issue for Drupal 6

danielb’s picture

Version: 6.x-2.9 » 5.x-3.9

The way I see it is you have two options

1) Hack the module.

<?php
function autocomplete_node_finder_get_fields() {

  $fields = content_fields();
  $field_array = array();
  $field_array['autocomplete_node_finder_nr.title'] = t('Node: Title');
  $field_array['autocomplete_node_finder_nr.body'] = t('Node: Body');
  $field_array['autocomplete_node_finder_nr.teaser'] = t('Node: Teaser');

  foreach ((array)$fields as $field) {
    if ($field['type'] == 'text' || $field['type'] == 'number_integer' || $field['type'] == 'number_decimal') {
      $field_display_name = !empty($field['widget']['label']) ? $field['widget']['label'] : $field['field_name'];
      $node_type_name = node_get_types('name', $field['type_name']);
      $type_display_name = $node_type_name ? $node_type_name : $field['type_name'];
      $field_array[$field['type_name'].'.'.$field['field_name'].'.'.$field['db_storage']] = $type_display_name.': '.$field_display_name.' ('.$field['type'].')';
    }
  }
  return $field_array;
}
?>

There's the function. It might be a simple case of adding a line like

  $field_array['autocomplete_node_finder_nr.nid'] = t('Node: ID');

I normally don't recommend that but it is unlikely you will need to upgrade.

The other option is to use a CCK field which holds the value of your Node ID, such as the computed field module. http://drupal.org/project/computed_field

Sinan Erdem’s picture

Daniel, thank you very much for your kind support. The second option is very clever...

Status: Fixed » Closed (fixed)

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