menu_node_edit_user_create_content

Versions
menu_node_edit
menu_node_edit_user_create_content($plid, $account = NULL)

Get the node types that this user can create..

Parameters

$plid The parent menu item (i.e. the section) we are looking at.

$account The user account being checked.

Return value

HTML links to create content in this section.

Code

./menu_node_edit.page.inc, line 126

<?php
function menu_node_edit_user_create_content($plid, $account = NULL) {
  $allowed = array();
  $types = node_get_types();
  $options = array('query' => array('section' => $plid));
  foreach ($types as $type => $value) {
    if (user_access('administer nodes') || user_access('create '. $type .' content', $account)) {
      $allowed[] = l(t('Create new !type', array('!type' => $value->name)), 'node/add/'. str_replace('_', '-', $type), $options);
    }
  }
  if (empty($allowed)) {
    return;
  }
  return theme('item_list', $allowed, t('Create content'));
}
?>

Contact

  • agentrickard [at] gmail [dot] com

Donations

My Amazon.com Wish List