Skip to main content
added 666 characters in body
Source Link
Jimajamma
  • 17.1k
  • 1
  • 28
  • 35

If you set node creation permission (Node Module on www.yourhost.com/admin/user/permissions) to specific roles, the existing form should take care of this automagically by itself, eg, if the user accessing www.yourhost.com/node/add can't create a specific node type, it won't be presented on that page.

Based upon commentary, node/add is built via:

function node_add_page() {
  $item = menu_get_item();
  $content = system_admin_menu_block($item);
  return theme('node_add_list', $content);
}   
    
/** 
 * Display the list of available node types for node creation.
 *  
 * @ingroup themeable
 */ 
function theme_node_add_list($content) {
  $output = '';
  
  if ($content) {
    $output = '<dl class="node-type-list">';
    foreach ($content as $item) {
      $output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
      $output .= '<dd>'. filter_xss_admin($item['description']) .'</dd>';
    }
    $output .= '</dl>';
  } 
  return $output;
} 

so you most certainly could create a new YOURTHEME_node_add_list() function that filters the links based upon a user's role realizing that if the user entered the link directly it would nonetheless still work.

You could also create a node-add-list.tpl.php in your theme's directory with basically this in it as a start:

<?php
  
  $output='';

  if ($content) {
    $output = '<dl class="node-type-list lrfm-ed">';
    foreach ($content as $item) {
      $output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
      $output .= '<dd>'. filter_xss_admin($item['description']) .'</dd>';
    }
    $output .= '</dl>';
  } 
  print $output;

and then modify it however you wanted.

Just flush caches after either to make drupal's theme system see and pick up the changes.

If you set node creation permission (Node Module on www.yourhost.com/admin/user/permissions) to specific roles, the existing form should take care of this automagically by itself, eg, if the user accessing www.yourhost.com/node/add can't create a specific node type, it won't be presented on that page.

Based upon commentary, node/add is built via:

function node_add_page() {
  $item = menu_get_item();
  $content = system_admin_menu_block($item);
  return theme('node_add_list', $content);
}   
    
/** 
 * Display the list of available node types for node creation.
 *  
 * @ingroup themeable
 */ 
function theme_node_add_list($content) {
  $output = '';
  
  if ($content) {
    $output = '<dl class="node-type-list">';
    foreach ($content as $item) {
      $output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
      $output .= '<dd>'. filter_xss_admin($item['description']) .'</dd>';
    }
    $output .= '</dl>';
  } 
  return $output;
} 

so you most certainly could create a new YOURTHEME_node_add_list() function that filters the links based upon a user's role realizing that if the user entered the link directly it would nonetheless still work.

If you set node creation permission (Node Module on www.yourhost.com/admin/user/permissions) to specific roles, the existing form should take care of this automagically by itself, eg, if the user accessing www.yourhost.com/node/add can't create a specific node type, it won't be presented on that page.

Based upon commentary, node/add is built via:

function node_add_page() {
  $item = menu_get_item();
  $content = system_admin_menu_block($item);
  return theme('node_add_list', $content);
}   
    
/** 
 * Display the list of available node types for node creation.
 *  
 * @ingroup themeable
 */ 
function theme_node_add_list($content) {
  $output = '';
  
  if ($content) {
    $output = '<dl class="node-type-list">';
    foreach ($content as $item) {
      $output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
      $output .= '<dd>'. filter_xss_admin($item['description']) .'</dd>';
    }
    $output .= '</dl>';
  } 
  return $output;
} 

so you most certainly could create a new YOURTHEME_node_add_list() function that filters the links based upon a user's role realizing that if the user entered the link directly it would nonetheless still work.

You could also create a node-add-list.tpl.php in your theme's directory with basically this in it as a start:

<?php
  
  $output='';

  if ($content) {
    $output = '<dl class="node-type-list lrfm-ed">';
    foreach ($content as $item) {
      $output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
      $output .= '<dd>'. filter_xss_admin($item['description']) .'</dd>';
    }
    $output .= '</dl>';
  } 
  print $output;

and then modify it however you wanted.

Just flush caches after either to make drupal's theme system see and pick up the changes.

added 1023 characters in body
Source Link
Jimajamma
  • 17.1k
  • 1
  • 28
  • 35

If you set node creation permission (Node Module on www.yourhost.com/admin/user/permissions) to specific roles, the existing form should take care of this automagically by itself, eg, if the user accessing www.yourhost.com/node/add can't create a specific node type, it won't be presented on that page.

Based upon commentary, node/add is built via:

function node_add_page() {
  $item = menu_get_item();
  $content = system_admin_menu_block($item);
  return theme('node_add_list', $content);
}   
    
/** 
 * Display the list of available node types for node creation.
 *  
 * @ingroup themeable
 */ 
function theme_node_add_list($content) {
  $output = '';
  
  if ($content) {
    $output = '<dl class="node-type-list">';
    foreach ($content as $item) {
      $output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
      $output .= '<dd>'. filter_xss_admin($item['description']) .'</dd>';
    }
    $output .= '</dl>';
  } 
  return $output;
} 

so you most certainly could create a new YOURTHEME_node_add_list() function that filters the links based upon a user's role realizing that if the user entered the link directly it would nonetheless still work.

If you set node creation permission (Node Module on www.yourhost.com/admin/user/permissions) to specific roles, the existing form should take care of this automagically by itself, eg, if the user accessing www.yourhost.com/node/add can't create a specific node type, it won't be presented on that page.

If you set node creation permission (Node Module on www.yourhost.com/admin/user/permissions) to specific roles, the existing form should take care of this automagically by itself, eg, if the user accessing www.yourhost.com/node/add can't create a specific node type, it won't be presented on that page.

Based upon commentary, node/add is built via:

function node_add_page() {
  $item = menu_get_item();
  $content = system_admin_menu_block($item);
  return theme('node_add_list', $content);
}   
    
/** 
 * Display the list of available node types for node creation.
 *  
 * @ingroup themeable
 */ 
function theme_node_add_list($content) {
  $output = '';
  
  if ($content) {
    $output = '<dl class="node-type-list">';
    foreach ($content as $item) {
      $output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
      $output .= '<dd>'. filter_xss_admin($item['description']) .'</dd>';
    }
    $output .= '</dl>';
  } 
  return $output;
} 

so you most certainly could create a new YOURTHEME_node_add_list() function that filters the links based upon a user's role realizing that if the user entered the link directly it would nonetheless still work.

Source Link
Jimajamma
  • 17.1k
  • 1
  • 28
  • 35

If you set node creation permission (Node Module on www.yourhost.com/admin/user/permissions) to specific roles, the existing form should take care of this automagically by itself, eg, if the user accessing www.yourhost.com/node/add can't create a specific node type, it won't be presented on that page.