Hi there!
I´m pretty new to rules (I´ve tried it in the past, but I think this module is just too much, I´m not a php expert, and maybe the rules I have in ming cannot be done without php...)
I´ve got content type XYZ that is a group post. When users add new content of that type and hit "save" I want them to be save the node and to be redirected to a new node create form of the same content type of the same group, for people to add new content (of the same type, for the same group they are in) without the need of go and click in "add new XYZ content".
Is that doable?
The other view I need is that after creating content of type XYZ, if the user wants to edit that node (and only in the node/%/edit form and NOT node/add form), some fields will be disabled. Will appear with the original content, but will not be able to be changed.
I just need to know if I can do that with rules (and maybe some advice about how they can be done, at least some guidance :).
Thaks for all your help and patience with this newbie!
Rosamunda
Comments
Comment #1
vm commentedI think you want http://drupal.org/project/addanother for at least the first part of your desire.
[edit] nope never mind I should have looked at the screenshot closer. It adds a link in the message area and doesn't just jump to a new form.
Comment #2
Rosamunda commentedYup, I´ve checked that module before, but thought that maybe rules could do what I needed. I´ve revisited all examples, but none of them seems to fit...
Comment #3
Rosamunda commentedFor the first one, I think that it can be done with a tokenized redirect.
The thing is that the token [node:og-id] doesn´t seems to work. (in fact; all tokens work except the group ones, is like it won´t take the group).
So if I´m at /node/add/story?gids[]=16 (where 16 is the group´s id), and save that story, I want the user to go again to /node/add/story?gids[]=16 to create another one right away.
I´ve set: /node/add/story ? gids[]=[node:og-id]
and won´t work. I´ve even tried:
gids[]=<?php $gid; ?>I´ve set the rule:
ON event After saving new content
Content created is story
AND
Content is a group post
DO
Redirect to ... And here is that I´ve tried: /node/add/story?gids[]=[node:og-id]
If I try other tokens it works, but after the = nothing shows up, as if the token weren´t there...
Any ideas?
Thanks!!
Rosamunda
Comment #4
Rosamunda commentedI´ve tried this too (without success):
ON event After saving new content
IF
Created content is story
AND
Content is a group post
DO
Save a contenido
Execute custom PHP code
Redirect to a new node/story/add but for the same group the user is still in
The custom code is
The Redirect to a new node/story/add but for the same group the user is still in shows this
node/add/story?gids[]=<?php print $output;?>I´m still being redirected to:
http://www.mysite.com/node/add/story?gids[]=
Maybe I could add a redirect rule inside the php code, instead of adding it with a separate action... but I don´t know how.
Comment #5
Rosamunda commentedThis is what I´ve tried but there´s a sintaxis problem... because I get an error
the error:
And if I change it to
It won´t appear the error, but there is no redirection either...
Comment #6
mitchell commented> "When users add new content of that type and hit "save" I want them to be save the node and to be redirected to a new node create form"
Event: new content is saved
Condition: content has type X
Action: redirect to "node/add/type"
> "some fields will be disabled"
#538834: Rules action - disable a form element
#733558: Remove Action "Disable form element" because it erases field values
> "of the same content type of the same group" / autofilling form values
In the field settings, you can set the default value there. I personally recommend you put your custom php in a custom module and call that function in the field settings. You can also use rules's form support to autofill values.
When you redirect, you can instead put "node/add/[type]/%1" and use that value to fill the field value.