Create a Drupal 6 Action to Delete a Nodes menu link

Hi Experts,

I'm proficient in PHP but novice in Drupal. I have Actions, Triggers and Workflow setup. From what I've read I need to create a function to implement hook_action_info() and a callback function which calls menu_link_delete. Does anybody know what I'm talking about and can anybody tell me how to do this?

To be precise when a Workflow transition is triggered on a particular Node (called Exhibition) I want an Action that removes any reference to the Node from the Primary Navigation menu.

LVL 10
Who is Participating?
mstrelanConnect With a Mentor Author Commented:
Well no one replied but I found the solution myself. 1. Make a module 2. Create an action. See below
; File
name = "Menu Unlink"
description = "Provides menu unlinking actions for nodes"
core = 6.x
' File menu_unlink.module
function menu_unlink_action_info() {
  return array(
    'menu_unlink_remove_from_menu_action' => array(
      'type' => 'node',
      'description' => t('Remove from menu'),
      'configurable' => FALSE,
      'behavior' => array('changes_node_property'),
      'hooks' => array(
        'nodeapi' => array('presave'),
function menu_unlink_remove_from_menu_action(&$node, $context = array()) {
  menu_link_delete(NULL, 'node/' . $node->nid);

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.