updating Auto Expire to D6 need help with the menu
verlierer - April 28, 2009 - 18:49
| Project: | Auto Expire |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
| Issue tags: | Drupal 6 porting |
Jump to:
Description
Hi. I'm trying this module for D6, but am having some problems with the hook_menu for D6. Specifically on how to get a tab on the node page.
The D5 code looks like this:
// hook_menu
function auto_expire_menu($may_cache) {
$items = array();
if ($may_cache) {
}
else {
$items[] = array(
'path' => 'admin/settings/auto_expire',
'title' => t('Auto Expire'),
'description' => t('Set node types that auto expire.'),
'callback' => 'drupal_get_form',
'callback arguments' => '_auto_expire_admin_settings',
'access' => user_access(ADMINISTER_AUTO_EXPIRE),
'type' => MENU_NORMAL_ITEM,
);
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if (_auto_expire_is_expiring_node($node)) {
$items[] = array(
'path' => 'node/' . $node->nid . '/expiry',
'title' => t('Extend'),
'description' => t('See and extend the expiry period.'),
'callback' => 'drupal_get_form',
'callback arguments' => array('_auto_expire_expiry', $node->nid),
'access' => _auto_expire_can_user_extend($node),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
);
}
}
}
return $items;
}So far, I've come up with this (but I really don't know what I'm doing):
//hook menu for D6
function auto_expire_menu() {
$items['admin/settings/auto_expire'] = array(
'title' => 'Auto Expire',
'page callback' => 'drupal_get_form',
'page arguments' => array('_auto_expire_admin_settings'),
// NOTE: as of Drupal 6.2, all menu items are *required* to have
// access control.
'access arguments' => array(ADMINISTER_AUTO_EXPIRE),
'type' => MENU_NORMAL_ITEM,
);
$items['node/%node/expiry'] = array(
'title' => 'Extend',
'description' => 'See and extend the expiry period.',
'page callback' => 'drupal_get_form',
'page arguments' => array('_auto_expire_expiry', 2),
'access arguments' => array(_auto_expire_can_user_extend($node)),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
);
return $items;
}I think the problem might be the "access arguments", but I'm not sure what I can do there.
I've also tried:
'access arguments' => array('administer access control'),but that didn't work either.
Here are two resources that I'm working off of: http://drupal.org/node/109153 and http://drupal.org/node/103114
Any help would be GREATLY appreciated.

#1
Did you look at the code in #313280-13: Port to D6? I posted a D6 port of the module there.
#2
The D6 port in #313280: Port to D6 looks very good (including the tab on the node page). Since this support request is essentially an attempt to port AE to D6, I think we should call this a duplicate.