I'm developping a website where I'm asked to add a tab "Publish content" next to the Edit tab. I was told to use the hook_menu, but so far i didn't succeed in showing the tab.

Here is what I have done so far :

function mij_bo_add_menu(){
    global $items;
    $items['node/%node/edit'] = array(
        'title' => t('Publish'),
        'page callback' => 'node_page_view',
        'page arguments' => $items['#primary'][1]['#link']['page_arguments'],
        'access callback' => 'node_access',
        'access arguments' => array(1),
        'weight' => 5,
        'type' => MENU_LOCAL_TASK,

Any suggestions?

PS : I am still a novice in Drupal programming.

2 Answers 2


There's already a module called Publish Content that does what you exactly describe. You can browse the source code if you want to see how it's implemented there.

  • Unfortunately this module doesn't allow checkbox or ajax link
    – Elia Weiss
    Commented Jan 26, 2019 at 6:17

Use the Flag module to create a GLOBAL flag to be used by authorized editors. For any node for which the flag is turned on, let the Rules module update the status to published. Done ... No coding needed/involved.

The actual implementation of such flag can either be:

  • a link somewhere when viewing the node (click such link to toggle the flag on/off).
  • a checkbox to be turned on/off while editing the node.

If you're not familiar with Rules, checkout the video tutorials Learn the Rules framework. And/or the similar set of 8 video tutorials about the Flag module. Especially the video tutorial about Triggering Rules with Flag is pretty close to what you want to do here: instead of changing the some of the node access permissions (as in the video), you just want to change the node status to published.

Note: The video How to add a Flag link to a Drupal View shows how to add a flag to a view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.