You need to use hook_menu()
to define the path, coupled with the MENU_LOCAL_TASK
type, e.g.
function MYMODULE_menu() {
$items['node/%node/approve'] = array(
'title' => 'Approve',
'type' => MENU_LOCAL_TASK,
'access arguments' => array('my custom args'),
'page callback' => 'MYMODULE_approve_node_page',
'page arguments' => array(1),
'weight' => -1 // Controls the display order for the tab
);
return $items;
}
Then you just implement a callback function, which has the node passed as a parameter, and build up your page output:
function MYMODULE_approve_node_page($node) {
// Do something with $node...
$build = array(
'#markup' => node_view($node, 'teaser')
);
return $build;
}
Once you clear Drupal's caches you should see the new tab appear alongside the View/Edit tabs on a node page, but only for those users who have the permission you define in your access arguments
.