Enable a node's menu item when on that node? I have a node for which there is a menu item. I want this menu item to be disabled except when the user is viewing that node. Can I do this, and if so how?
I will write a method that you can use by simply editing your theme's template.php file (without having to write your own module), and overriding


theme_link(), 
theme_links(), 
theme_site_map_menu_link(), 
theme_superfish_build() AND 
theme_menu_link() 


functions. YES, that's correct, unfortunately for the correct markup, you have to override all of the above mentioned functions in your own theme, to avoid rendering empty &lt;li&gt; elements in the default main menu, in the Superfish menu or the Site map module's own menu. I will assume you haven't already overridden them.
I tested it, so this code should be working, but please ask if you have any kind of questions.


First, please open your theme's template.php in a text editor of your choice.
Paste the whole code below into the opened template.php.

/**
 * Should this link be hidden?
 * 
 * @see http://drupal.stackexchange.com/questions/27907/enable-a-nodes-menu-item-when-on-that-node/27922
 * 
 * @param string $link_path The path that should be inspected.
 * @return boolean 
 */
function YOURTHEMENAME_link_should_be_hidden($link_path) {

    // in this example, I let "contact" and "node/9" links only be visible
    // on their own path (so for example, I let "contact" path be visible 
    // in the menu if the user opened "example.com/contact").    
    $your_paths_to_show_in_menu_only_on_their_own_path = array('contact', 'node/9'); // SUBSTITUTE IT with yours - empty cache every time you change that
    $is_link_to_hide = in_array($link_path, $your_paths_to_show_in_menu_only_on_their_own_path);
    if ($is_link_to_hide) {
        $is_current_page_self = ($link_path == $_GET['q']);
        // these links will be visible only on their own paths -
        // BUT here you can define other paths too where they can be visible at!
        // So for example, you want "example.com/node/9" to be visible when visiting its own path
        // AND when visiting "example.com/node/3" OR "example.com/any_other_path".
        // But if you do NOT want any other pages for these links to be visible at, then
        // just leave it empty (like this: array()).
        $link_also_visible_at_paths = array('node/3', 'any_other_path'); // SUBSTITUTE IT with your paths! - empty cache every time you change that
        $element_can_be_visible = $is_current_page_self || (!empty($link_also_visible_at_paths) &amp;&amp; in_array($_GET['q'], $link_also_visible_at_paths));

        if (!$element_can_be_visible) {
            return TRUE;
        }
    }
    return FALSE;
}

/**
 * Overriding theme_menu_link()
 * 
 * @see http://api.drupal.org/api/drupal/includes%21menu.inc/function/theme_menu_link/7
 */
function YOURTHEMENAME_menu_link(array $variables) {
    /**
     * @see http://drupal.stackexchange.com/questions/27907/enable-a-nodes-menu-item-when-on-that-node/27922
     */
    if (YOURTHEMENAME_link_should_be_hidden($variables['element']['#href'])) {
        return '';
    }

    $element = $variables['element'];
    $sub_menu = '';

    if ($element['#below']) {
        $sub_menu = drupal_render($element['#below']);
    }
    $output = l($element['#title'], $element['#href'], $element['#localized_options']);
    return '&lt;li' . drupal_attributes($element['#attributes']) . '&gt;' . $output . $sub_menu . "&lt;/li&gt;\n";
}

/**
 * Helper function that builds the nested lists of a Superfish menu.
 * @see theme_superfish_build()
 */
function YOURTHEMENAME_superfish_build($variables) {

    $output = array('content' =&gt; '');
    $id = $variables['id'];
    $menu = $variables['menu'];
    $depth = $variables['depth'];
    $trail = $variables['trail'];
    // Keep $sfsettings untouched as we need to pass it to the child menus.
    $settings = $sfsettings = $variables['sfsettings'];
    $megamenu = $settings['megamenu'];
    $total_children = $parent_children = $single_children = 0;
    $i = 1;

    // Reckon the total number of available menu items.
    foreach ($menu as $menu_item) {
        if (!isset($menu_item['link']['hidden']) || $menu_item['link']['hidden'] == 0) {
            $total_children++;
        }
    }

    foreach ($menu as $menu_item) {

        $show_children = $megamenu_wrapper = $megamenu_column = $megamenu_content = FALSE;
        $item_class = $link_options = $link_class = array();
        $mlid = $menu_item['link']['mlid'];

        /**
         * @see http://drupal.stackexchange.com/questions/27907/enable-a-nodes-menu-item-when-on-that-node/27922
         */
        if (YOURTHEMENAME_link_should_be_hidden($menu_item['link']['link_path'])) {
            continue;
        }

        if (!isset($menu_item['link']['hidden']) || $menu_item['link']['hidden'] == 0) {
            $item_class[] = ($trail &amp;&amp; in_array($mlid, $trail)) ? 'active-trail' : '';

            // Add helper classes to the menu items and hyperlinks.
            $settings['firstlast'] = ($settings['dfirstlast'] == 1 &amp;&amp; $total_children == 1) ? 0 : $settings['firstlast'];
            $item_class[] = ($settings['firstlast'] == 1) ? (($i == 1) ? 'first' : (($i == $total_children) ? 'last' : 'middle')) : '';
            $settings['zebra'] = ($settings['dzebra'] == 1 &amp;&amp; $total_children == 1) ? 0 : $settings['zebra'];
            $item_class[] = ($settings['zebra'] == 1) ? (($i % 2) ? 'odd' : 'even') : '';
            $item_class[] = ($settings['itemcount'] == 1) ? 'sf-item-' . $i : '';
            $item_class[] = ($settings['itemdepth'] == 1) ? 'sf-depth-' . $menu_item['link']['depth'] : '';
            $link_class[] = ($settings['itemdepth'] == 1) ? 'sf-depth-' . $menu_item['link']['depth'] : '';
            $item_class[] = ($settings['liclass']) ? $settings['liclass'] : '';
            if (strpos($settings['hlclass'], ' ')) {
                $l = explode(' ', $settings['hlclass']);
                foreach ($l as $c) {
                    $link_class[] = $c;
                }
            }
            else {
                $link_class[] = $settings['hlclass'];
            }
            $i++;

            // Add hyperlinks description (title) to their text.
            $show_linkdescription = ($settings['linkdescription'] == 1 &amp;&amp; !empty($menu_item['link']['localized_options']['attributes']['title'])) ? TRUE : FALSE;
            if ($show_linkdescription) {
                if (!empty($settings['hldmenus'])) {
                    $show_linkdescription = (is_array($settings['hldmenus'])) ? ((in_array($mlid, $settings['hldmenus'])) ? TRUE : FALSE) : (($mlid == $settings['hldmenus']) ? TRUE : FALSE);
                }
                if (!empty($settings['hldexclude'])) {
                    $show_linkdescription = (is_array($settings['hldexclude'])) ? ((in_array($mlid, $settings['hldexclude'])) ? FALSE : $show_linkdescription) : (($settings['hldexclude'] == $mlid) ? FALSE : $show_linkdescription);
                }
                if ($show_linkdescription) {
                    $menu_item['link']['title'] .= '&lt;span class="sf-description"&gt;';
                    $menu_item['link']['title'] .= (!empty($menu_item['link']['localized_options']['attributes']['title'])) ? $menu_item['link']['localized_options']['attributes']['title'] : array();
                    $menu_item['link']['title'] .= '&lt;/span&gt;';
                    $link_options['html'] = TRUE;
                }
            }

            // Add custom HTML codes around the menu items.
            if ($sfsettings['wrapul'] &amp;&amp; strpos($sfsettings['wrapul'], ',') !== FALSE) {
                $wul = explode(',', $sfsettings['wrapul']);
                // In case you just wanted to add something after the element.
                if (drupal_substr($sfsettings['wrapul'], 0) == ',') {
                    array_unshift($wul, '');
                }
            }
            else {
                $wul = array();
            }

            // Add custom HTML codes around the hyperlinks.
            if ($settings['wraphl'] &amp;&amp; strpos($settings['wraphl'], ',') !== FALSE) {
                $whl = explode(',', $settings['wraphl']);
                // The same as above
                if (drupal_substr($settings['wraphl'], 0) == ',') {
                    array_unshift($whl, '');
                }
            }
            else {
                $whl = array();
            }

            // Add custom HTML codes around the hyperlinks text.
            if ($settings['wraphlt'] &amp;&amp; strpos($settings['wraphlt'], ',') !== FALSE) {
                $whlt = explode(',', $settings['wraphlt']);
                // The same as above
                if (drupal_substr($settings['wraphlt'], 0) == ',') {
                    array_unshift($whlt, '');
                }
                $menu_item['link']['title'] = $whlt[0] . check_plain($menu_item['link']['title']) . $whlt[1];
                $link_options['html'] = TRUE;
            }


            if (!empty($menu_item['link']['has_children']) &amp;&amp; !empty($menu_item['below']) &amp;&amp; $depth != 0) {
                // Megamenu is still beta, there is a good chance much of this will be changed.
                if (!empty($settings['megamenu_exclude'])) {
                    if (is_array($settings['megamenu_exclude'])) {
                        $megamenu = (in_array($mlid, $settings['megamenu_exclude'])) ? 0 : $megamenu;
                    }
                    else {
                        $megamenu = ($settings['megamenu_exclude'] == $mlid) ? 0 : $megamenu;
                    }
                    // Send the result to the sub-menu.
                    $sfsettings['megamenu'] = $megamenu;
                }
                if ($megamenu == 1) {
                    $megamenu_wrapper = ($menu_item['link']['depth'] == $settings['megamenu_depth']) ? TRUE : FALSE;
                    $megamenu_column = ($menu_item['link']['depth'] == $settings['megamenu_depth'] + 1) ? TRUE : FALSE;
                    $megamenu_content = ($menu_item['link']['depth'] &gt;= $settings['megamenu_depth'] &amp;&amp; $menu_item['link']['depth'] &lt;= $settings['megamenu_levels']) ? TRUE : FALSE;
                }
                // Render the sub-menu.
                $var = array(
                  'id' =&gt; $id,
                  'menu' =&gt; $menu_item['below'],
                  'depth' =&gt; $depth, 'trail' =&gt; $trail,
                  'sfsettings' =&gt; $sfsettings
                );
                $children = theme('superfish_build', $var);
                // Check to see whether it should be displayed.
                $show_children = (($menu_item['link']['depth'] &lt;= $depth || $depth == -1) &amp;&amp; $children['content']) ? TRUE : FALSE;
                if ($show_children) {
                    // Add item counter classes.
                    if ($settings['itemcounter']) {
                        $item_class[] = 'sf-total-children-' . $children['total_children'];
                        $item_class[] = 'sf-parent-children-' . $children['parent_children'];
                        $item_class[] = 'sf-single-children-' . $children['single_children'];
                    }
                    // More helper classes.
                    $item_class[] = ($megamenu_column) ? 'sf-megamenu-column' : '';
                    $item_class[] = $link_class[] = 'menuparent';
                }
                $parent_children++;
            }
            else {
                $item_class[] = 'sf-no-children';
                $single_children++;
            }

            $item_class = implode(' ', array_filter($item_class));

            if (isset($menu_item['link']['localized_options']['attributes']['class'])) {
                $link_class_current = $menu_item['link']['localized_options']['attributes']['class'];
                $link_class = array_merge($link_class_current, array_filter($link_class));
            }
            $menu_item['link']['localized_options']['attributes']['class'] = $link_class;

            $link_options['attributes'] = $menu_item['link']['localized_options']['attributes'];

            // Render the menu item.
            $output['content'] .= '&lt;li id="menu-' . $mlid . '-' . $id . '"';
            $output['content'] .= ($item_class) ? ' class="' . trim($item_class) . '"&gt;' : '&gt;';
            $output['content'] .= ($megamenu_column) ? '&lt;div class="sf-megamenu-column"&gt;' : '';
            $output['content'] .= isset($whl[0]) ? $whl[0] : '';
            $output['content'] .= l($menu_item['link']['title'], $menu_item['link']['link_path'], $link_options);
            $output['content'] .= isset($whl[1]) ? $whl[1] : '';
            $output['content'] .= ($megamenu_wrapper) ? '&lt;ul class="sf-megamenu"&gt;&lt;li class="sf-megamenu-wrapper ' . $item_class . '"&gt;' : '';
            $output['content'] .= ($show_children) ? (isset($wul[0]) ? $wul[0] : '') : '';
            $output['content'] .= ($show_children) ? (($megamenu_content) ? '&lt;ol&gt;' : '&lt;ul&gt;') : '';
            $output['content'] .= ($show_children) ? $children['content'] : '';
            $output['content'] .= ($show_children) ? (($megamenu_content) ? '&lt;/ol&gt;' : '&lt;/ul&gt;') : '';
            $output['content'] .= ($show_children) ? (isset($wul[1]) ? $wul[1] : '') : '';
            $output['content'] .= ($megamenu_wrapper) ? '&lt;/li&gt;&lt;/ul&gt;' : '';
            $output['content'] .= ($megamenu_column) ? '&lt;/div&gt;' : '';
            $output['content'] .= '&lt;/li&gt;';
        }
    }
    $output['total_children'] = $total_children;
    $output['parent_children'] = $parent_children;
    $output['single_children'] = $single_children;
    return $output;
}

/**
 * Overriding theme_site_map_menu_link()
 *
 * @param array $variables
 * @return string 
 */
function YOURTHEMENAME_site_map_menu_link($variables) {

    $element = $variables['element'];
    $sub_menu = '';

    /**
     * @see http://drupal.stackexchange.com/questions/27907/enable-a-nodes-menu-item-when-on-that-node/27922
     */
    if (YOURTHEMENAME_link_should_be_hidden($element['#href'])) {
        return '';
    }

    if ($element['#below']) {
        $sub_menu = drupal_render($element['#below']);
    }
    $output = l($element['#title'], $element['#href'], $element['#localized_options']);
    return '&lt;li' . drupal_attributes($element['#attributes']) . '&gt;' . $output . $sub_menu . "&lt;/li&gt;\n";
}

/**
 * Returns HTML for a set of links.
 * @see theme_links()
 */
function YOURTHEMENAME_links($variables) {
    $links = $variables['links'];
    $attributes = $variables['attributes'];
    $heading = $variables['heading'];
    global $language_url;
    $output = '';

    if (count($links) &gt; 0) {
        $output = '';

        // Treat the heading first if it is present to prepend it to the
        // list of links.
        if (!empty($heading)) {
            if (is_string($heading)) {
                // Prepare the array that will be used when the passed heading
                // is a string.
                $heading = array(
                  'text' =&gt; $heading,
                  // Set the default level of the heading.
                  'level' =&gt; 'h2',
                );
            }
            $output .= '&lt;' . $heading['level'];
            if (!empty($heading['class'])) {
                $output .= drupal_attributes(array('class' =&gt; $heading['class']));
            }
            $output .= '&gt;' . check_plain($heading['text']) . '&lt;/' . $heading['level'] . '&gt;';
        }

        $output .= '&lt;ul' . drupal_attributes($attributes) . '&gt;';

        $num_links = count($links);
        $i = 1;

        foreach ($links as $key =&gt; $link) {

            /**
             * @see http://drupal.stackexchange.com/questions/27907/enable-a-nodes-menu-item-when-on-that-node/27922
             */
            if (YOURTHEMENAME_link_should_be_hidden($link['href'])) {
                continue;
            }


            $class = array($key);

            // Add first, last and active classes to the list of links to help out themers.
            if ($i == 1) {
                $class[] = 'first';
            }
            if ($i == $num_links) {
                $class[] = 'last';
            }
            if (isset($link['href']) &amp;&amp; ($link['href'] == $_GET['q'] || ($link['href'] == '&lt;front&gt;' &amp;&amp; drupal_is_front_page()))
                &amp;&amp; (empty($link['language']) || $link['language']-&gt;language == $language_url-&gt;language)) {
                $class[] = 'active';
            }
            $output .= '&lt;li' . drupal_attributes(array('class' =&gt; $class)) . '&gt;';

            if (isset($link['href'])) {
                // Pass in $link as $options, they share the same keys.
                $output .= l($link['title'], $link['href'], $link);
            }
            elseif (!empty($link['title'])) {
                // Some links are actually not links, but we wrap these in &lt;span&gt; for adding title and class attributes.
                if (empty($link['html'])) {
                    $link['title'] = check_plain($link['title']);
                }
                $span_attributes = '';
                if (isset($link['attributes'])) {
                    $span_attributes = drupal_attributes($link['attributes']);
                }
                $output .= '&lt;span' . $span_attributes . '&gt;' . $link['title'] . '&lt;/span&gt;';
            }

            $i++;
            $output .= "&lt;/li&gt;\n";
        }

        $output .= '&lt;/ul&gt;';
    }

    return $output;
}

/**
 * Theming links (theme_link())
 * @see http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_link/7
 *
 */
function YOURTHEMENAME_link($variables) {
    /**
     * @see http://drupal.stackexchange.com/questions/27907/enable-a-nodes-menu-item-when-on-that-node/27922
     */
    if (YOURTHEMENAME_link_should_be_hidden($variables['path'])) {
        return '';
    }

    return '&lt;a href="' . check_plain(url($variables['path'], $variables['options'])) . '"' . drupal_attributes($variables['options']['attributes']) . '&gt;' . ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text'])) . '&lt;/a&gt;';
}

Substitute YOURTHEMENAME with your own theme's name.
Substitute the values of $your_paths_to_show_in_menu_only_on_their_own_pathand $link_also_visible_at_paths variables in the previous step with your appropriate values. In the previous example, I hide the "contact" AND node/9 pages' menu link by default, and let them only be visible when we are viewing these pages themselves OR when displaying node/3 or any_other_path paths (so in any other cases, I don't see the link to "contact" or node/9).
Save the file.
Clear the cache!


So the final code should look similar to this: http://pastebin.com/PzQFhykn.

BUT in your exact case, you would like to hide node/425, so your code should look like this: http://pastebin.com/DKi5aSyq

Ask if something isn't quite clear.