You are here

function node_convert_return_access_node_types in Node Convert 6

Same name and namespace in other branches
  1. 7 node_convert.module \node_convert_return_access_node_types()

Returns a list of node types that the user has access to, depending on the direction of conversion.

Parameters

$direction: A string containing either 'to' or 'from'.

Return value

An array of node types or FALSE if the user doesn't have access to any node type.

2 calls to node_convert_return_access_node_types()
node_convert_add_template in ./node_convert.module
node_convert_conversion_form in ./node_convert.module

File

./node_convert.module, line 941
The node_convert module converts nodes from one type to another.

Code

function node_convert_return_access_node_types($direction) {
  global $user;
  $list = array();
  $types = node_get_types();
  foreach ($types as $type => $parameters) {
    if (user_access('administer conversion') || user_access('convert ' . $direction . ' ' . $type)) {
      $list[$type] = $parameters->name;
    }
  }
  if (!empty($list)) {
    return $list;
  }
  else {
    return FALSE;
  }
}