Okay so the title is a little weird... Here's my problem... Drupal 6.x bitches that you shouldn't define node/add/xxx links in hook_menu any more, that you should define a node_info() and then alter the callbacks in hook_menu_alter - which is fine, I can do that like this;

function tablemanager_node_info() {
  $tables = tablemanager_nodeadd();
  if ($tables) $description .= t('<dd>Choose from the following available tables: !tables', array('!tables' => tablemanager_nodeadd()));
  return array('table' => array('name' => t('table'), 'module' => 'tablemanager', 'description' => t('Create a new table.')),
    'tablemanager' => array('name' => t('table entry'), 'module' => 'tablemanager', 'description' => $description)
  );
}

function tablemanager_menu_alter(&$callbacks) {
  // Overwrite the default callbacks for node/add page
  $callbacks['node/add/table'] = array(
    'title' => 'Table',
    'description' => 'Create a new table.',
    'title callback' => 'check_plain',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('tablemanager_table_add'),
    'access callback' => '_tablemanager_table_add_access',
    'module' => 'tablemanager',
    'file' => 'tablemanager.tables.inc',
  );
}

function _tablemanager_table_add_access() {
  return user_access('administer tables') || user_access('administer/ create own tables') ? TRUE : FALSE;
}

My problem is that the permissions don't 'stick'? Even if a user is sufficiently 'permissioned' the link doesn't appear on the node/add page even though it appears just fine for user '1' (so it *must* be something permissions related?) I'm assuming that my removing the access callback for node_access and replacing it with my own callback is causing problems? Or perhaps I'm just misusing hook_menu_alter? I've no idea... I've been playing aimlessly with it for an hour now with no luck.

Any help or pointers would be very much appreciated, thank you!

Pobster

Comments

pobster’s picture

*bump* okay this is important, I've been able to create an entry on the node/add page since Drupal 4.6 without actually having to create a node. Can anybody help me with this?

Thanks,

Pobster

pobster’s picture

*bump* again. PLEASE this is really important to the functionality of my module, if anyone could help that'd be great.

Pobster