By shaynl on
Hey,
I tried look for a module or tweak for that with no luck…
How I can change the default setting for crating content that when I click "save" it will stay on the same page (the add form page) instead of going the new node page.
Same thing for editing an existing node.
Any idea?
Thanks,
Shay
Comments
Save and Edit
Hi,
Sounds like http://drupal.org/project/addanother or http://drupal.org/project/submitagain would help with the first situation, and http://drupal.org/project/save_edit with the second.
Hey, thanks!!
It's working great when adding a new node with submitagain but not when edit a node… save_edit not doing the job as I need the users to stay on the same page (the add new node page). The user can see the new nods in a block on that page (using views). Is it possible to edit node within a block view?
p.s
This is a print screen of my "add new node page":
http://www.mypicx.com/uploadimg/604093315_08192009_1.jpg
You could write your own
You could write your own module! Here's how -- haven't tried this, but might work and you could tweak it:
this goes in a file called redirectedit.module (or whatever you want to call it) (put the php tag in the beginning --don't need ?> in the ending, it just shows here to get the code formatted in color, and it's not needed for coding best practice where it has a risk of messing your web site page up for some reason if left in there.)
(switch out mycontenttype for your content type)
I'm going to use hook_nodeapi because it does a lot of node things, see here http://api.drupal.org/api/function/hook_nodeapi/6.
this goes in a file called redirectedit.info
; $Id$
name = Redirect to edit
description = Redirect user to add new node after saving a new node or updating an existing node.
core = 6.x
version = 6.x-1.0
those files go in a folder called sites/all/modules/redirectedit
there you have your new module! I think this will work, not sure. Also there's a http://drupal.org/project/formblock module to put forms in blocks. Hope that helps.
thanks, in case of a
thanks,
in case of a redirection to the edition form, redirection should be:
Thanks!!
I tried it now and it works like a charm!
How I can add more content types to this script?
Excellent!switch out the
Excellent!
copy the if block and paste beneath the first if block (without opening and closing php tags) to look like this
and switch out mycontentype for myothercontentype, repeat the copy for as many content types you need.
Hope that helps.
Easier way to do this
You only need to add new content types into the "if" line at the beginning.
Thanks!
Thanks!
not working
I have tried in D6 and it is not working; any hint?
function cc_assentaments_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if (($node->type=='cc_linia') && ($op=='insert')) {
$_REQUEST['destination'] = "cc_linia/".$node->nid.'/desglos';
}
}
La vida és una taronja, què esperes per exprimir-la?
my fault
I forgot a:
Inside the code. Now it works as a charm. At last I put the code inside hook_insert in order do avoid adding a hook_nodeapi.
La vida és una taronja, què esperes per exprimir-la?
thanks
Thanks Matthew :)
node type redirection
hi i also created that little module. no errors all fine but the redirection part dosent work.
to: enboig can you post your script here? how you implemented that code what you posted ?
Thanks.
I created a new submit
I created a new submit button and my own custom submit, like this:
in hook_form_alter:
Custom function:
I would avoid using
I would avoid using drupal_gioto() as much as I can. It stops drupal execution, so some hooks may be ignored.
La vida és una taronja, què esperes per exprimir-la?
for D7
use this in D7:
Why don't you try with Rules
Why don't you try with Rules module.
After saving new content -> Page redirect and you can use the Replacement patterns