Action triggered upon submitting

Events happening in the community are now at Drupal community events on www.drupal.org.
jimmb's picture

We are attempting to set up a workflow action for people to apply for a directory listing on a website. Editors should be notified that a submission has been received, so they will be able to review it. The eventual process will hopefully be something like this:

  1. An anonymous user fills out the CCK fields set up for Directory Listing content.
  2. Upon clicking "submit", an e-mail is sent out to site editor(s).
  3. The content goes into an unpublished "For Review" state.
  4. Editors review it and go from there....

I watched the "Actions and Workflow" videocast at Lullabot and set it up as far as I could. The first problem I'm discovering, though, is that it appears that a content node must already be created before an action can take place. Is there any way the action can be triggered when the content is submitted?? Any other pointers or tips on setting this up will also be appreciated :)

Thanks,

Jim

Comments

Solution: Action triggered upon submitting

pearcec's picture

I am doing virtually the same thing.

  1. Install CCK, Worflow, Actions, (I patch in some new actions) etc.
  2. Setup you CCK form, (Admin -> Site Building -> Content Types -> Add Content Type)
  3. Access Control (Admin -> User Management -> Access Control), set role "Anonymous User" (we use authenticated, you might consider doing that, or setup captcha, I realize it is moderated but you will get a lot of crap) for Create "Name of CCK content type".

The trick here is when they submit it will give them access denied for the content since it isn't publised and they can't edit their own content. So you need to have an action that redirects them to a thank you page or just a terse message, both of which are possible with actions and workflow

  1. Create a workflow (Admin -> Site Building -> Workflow -> Add workflow) name it "Name of CCK content type Publishing"
  2. This part is probably up to you, but I have Review, Publish and Archive along with the mandatory state (creation), you could ditch Archive if you don't care about that.
  3. Add the "Name of CCK Publishing" to "Name of CCK content type at the bottom of workflow"
  4. Then you have to edit who can do what, this is the hardest part for people to understand.

For creation -> Review I have:

  • Author
  • Moderator role

For Review -> Publish, Publish -> Review, Publish -> Archive, Publish -> Review, Archive -> Publish, Archive -> Review

  • Admin role or Moderator role up to you.

I just found this module that graphs the flow, it is nice:

http://drupal.org/project/workflow_graph

  1. Create new actions (Admin -> Site Building -> Actions -> Add new action):
  • Send email -> (Email the moderations list, currently don't know of an action that emails a role, I think there is one in the works)
    (http://drupal.org/node/156705)
  • Alert (I think this is stock)
  • Change node to person if you want (might not be what you want though)
  • Redirect to received submission page:
    (http://drupal.org/node/87431)
  1. Add the actions,

Transition Actions
(creation) → Review

  • Name of CCK Notification
  • Alert CCK submitter (This puts up a alert on the received submission page)
  • Change node author to employee_marketing (You don't have to do this as long as the moderator has access to edit this content type)
  • Redirect user to a received submission page

Review → Publish

  • Publish node

Publish → Archive

  • Unpublish node

Publish → Review

  • Unpublish node

Archive → Publish

  • Publish node

This is just the rough layout. It should help though. There are a lot of moving parts so it really pays to learn the system more than just implementing someone's solution. Hope this helps.

--
Christian

--
Christian

Very Helpful

jimmb's picture

Thanks so much for your excellent response. I will attempt to implement it and see what I can learn in the process.

Regards,

Jim

nessumsara's picture

Instead of having to create an action you can use a module called Node Go To (http://drupal.org/project/nodegoto) to redirect people after submitting a directory request. It alows you to set redirects per node per node action (insert, update, delete).

workflow-ng

fago's picture

you can also redirect by using workflow-ng as it allows you to configure actions for node insert, update & delete.
Or you could also try to implement the workflow with it too, here you can read how this works

workflow-ng

jimmb's picture

Thanks for alerting me to this module. I have found it to be easier and more straightforward than the standard Workflow or Actions modules. So at this point I've successfully set up a re-direct when a new entry is created, and created a view that shows the new entries at the admin level.

The one thing that isn't working is getting an e-mail to be sent when the content is created. First I set up an action upon content creation so that the "Arguments configuration" is "Acting user". I then set a condition to define the "Acting user" as the "The contact e-mail address for the entire Drupal site" so that the 2 texts to compare are: [user:site-mail] and the address I set in Site Configuration for "E-mail address".

However, this wasn't working, so I read more into the documentation and found "Writing actions and conditions" - "A more advanced example": http://drupal.org/node/156754. This makes it appear that a new argument must be added to enable selecting the correct e-mail address option. It also appears that I need to do this in the workflow_ng_actions.inc file....

So I guess at this point I have a question and a comment:

Question: Am I on the right track here? What if I want to specify a totally different e-mail address (or groups of addresses) not set up anywhere on the Drupal website. Also -- not being a PHP programmer -- is there any other advice to ease a non-programmer like myself through this process?

Comment: Since this is probably a frequently desired action, I would recommend to the developer at some point to add more default arguments that would give more options for notification e-mails :)

Thanks,

Jim

fine that you like the

fago's picture

fine that you like the module.

Yep, what you want is probably a fixed mail address for your notifications. Indeed, an appropriate action is missing here. I'll have a look at it to add one.

That would be great!

jimmb's picture

That would be great! Thanks,

Jim

don't know if you have

fago's picture

don't know if you have noticed, but the recent release of workflow-ng includes that already

The most straightforward

iuk2's picture

The most straightforward way to get an action triggered upon submission (such as sending an e-mail) is to set two action one after another.

On the first action you select "Change workflow state of post to new state" (make sure you have check the force transition" option)

and then select another action you like upon this change such as sending an e-mail.

Nice Addition

vegtabill's picture

Thanks for this last post. Very direct solution, and very helpful in my current project.

Thanks again!

Workflow

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: