You are here

function addanother_node_insert in Add Another 7

Implement hook_node_insert().

File

./addanother.module, line 141
Presents users with an option to create another node of the same type after a node is added.

Code

function addanother_node_insert($node) {
  $allowed_nodetypes = variable_get('addanother_nodetypes', array());
  if (user_access('use add another') && isset($allowed_nodetypes[$node->type]) && $allowed_nodetypes[$node->type]) {
    $_addanother_message = t('Add another <a href="@typeurl">%type</a>.', array(
      '@typeurl' => url('node/add/' . str_replace('_', '-', $node->type)),
      '%type' => node_type_get_name($node),
    ));
    drupal_set_message($_addanother_message, 'status', FALSE);
  }
}