HOw can I do this ?

freelylw - June 10, 2009 - 12:07

I want to let user submit several nodes, but will do it one by one, then after user finish to submit the first one, he will see a button which call' next one', then he can click the button to start to submit the next one.

Is there any module which I can use to do this ?? or any simple way I can do this ?

thanks

Submit Again

nevets - June 10, 2009 - 12:19

hook_nodeapi and drupal_set_message

marcvangend - June 10, 2009 - 12:39

Where do you want to show that button? After submission, users get see their new node. If you would redirect them to another page with a 'next one' button, they do not get the feedback of seeing their new node. I think the best solution would be to display a 'next one' link in the messages area, so your users get both the feedback and the option to add another one.

I would do it like this:
- Create a new module (if you never did that before, I heard this will help: http://drupal.org/project/module_builder)
- Implement hook_nodeapi in your new module (see also http://api.drupal.org/api/function/hook_fnodeapi/6). Your code would look something like this:

<?php
function MODULENAME_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch (
$op) {
    case
'insert':
      if(
$node->type == 'story'){
       
drupal_set_message(t('Your node has been created.') . ' ' . l(t('Next one'), 'node/add/story'));
      }
      break;
  }
}
?>

In this code, replace MODULENAME with the name of your module and replace story with the content type you want to apply this to.

[edit]
I didn't see Nevets' reply yet at the moment of posting... that's a nice approach as well, i didn't know that module :-)
[/edit]

 
 

Drupal is a registered trademark of Dries Buytaert.