Fjord

31. Oktober 2009

Drupal 6 Workflow-Tutorial

Filed under: — Muli @ 20:17

Hi there,

as you probably have read I nearly got nuts during my several tries on workflow-module. So I am desperate to get a good tutorial and to get someone to help me. So I start to write such a tutorial by describing my steps and asking YOU to add the bits to make it work.

Step 1: Install Drupal (6.14 a.t.m.) with workflow-module (1.3 a.t.m.) and views (2.6 to view Workflow summary)

  1. install drupal
  2. create modules folder in sites/all/
  3. download workflow module here and views here, expand the archives and put the workflow- and views-folder in sites/all/modules/

Step 2: activate trigger-, views- and workflow-module

  1. log in as Administrator
  2. got to Administer -> Site building -> Modules
  3. check boxes at: Trigger, Views, Workflow, Workflow access
  4. hit “Save configuration”
  5. Now drupal tells you that the content access permissions need to be rebuild. Click the shown link and then “Rebuild permissions”.

Step 3: change content type settings

The desired workflow here is build for the content type page. To publish the pages during the workflow we have to change it’s workflow settings to prevent it beeing published automatically after saving.

  1. go to Administer -> Content management -> Content types
  2. hit “edit” for the content type page

check the Workflow settings and make sure that “Published” and “Promoted to front page” are uncecked

Step 4: create writer and editor

For this workflow I’ll use two roles: one should be the “writer” and one the “moderator”. So lets create them.

  1. go to Administer -> User management -> Roles
  2. Type “writer” in the text-field and klick the “Add role” button
  3. repeat this with “moderator”

Step 5: create the actual workflow

For this tutorial I want to create a basic workflow. Where the writer writes his page. First state should be a draft where just the writer can mess around with his page. Then when he has finished writing he can set the state to “ready for review”. This is where the moderator comes in who hast the choice to publish the page oder to set it to “additional work needed”. So lets do it.

  1. got to Administer -> Site building -> Workflow
  2. click “Add workflow”
  3. call it “Page publishing” and hit “Add workflow”
  4. now you’re brought to a page where you should add your 4 states: “Draft”, “ready for review”, “additional work needed”, “published” (type the name in the text-field and hit “Save” the click “Add state” and do it again)
  5. If they show up in the right order go to the next step. If they don’t click edit and add a weight to them so that they go up or down as needed
  6. Now click “Edit” but up at the workflow line not down in line with one of your states and choose your transitions as shown in the screenshot
    workflowTransitions
    With this checkboxmaze you choose who can bring our page form some state (left row) to the following (top column). I hope my choice makes sense for you if not tell me and I’ll write more about this.
  7. Next you should scroll down to “Workflow tab permissions” and check boxes for writer and moderator. So that they both see the Workflow tab.
  8. Continue to scroll down till you get to the “Access control”-part. Here you grant or deny access to content in cerain states. So that for example only the author can view, edit and delete his draft and the moderator can’t see it until it’s ready for review and so on. So again my choices as a screenshot:
    workflowAccessControl
  9. Now hit save and you’re done with that

Step 6: befor you add triggers and actions you have to assign your workflow to a content type (here page)

  1. Scroll down till you see a list of content types. For page select your workflow in the drop down menu and hit “Save workflow mapping”

Step 7: Now we add a trigger  to publish  the page when it should be.

  1. go to Administer -> Site building -> Triggers
  2. Choos workflow at the top of the page
  3. Now above the dropdowns your read a change of state (for example from Draft to Ready to review) and such a change can be the trigger for an action. So search for everything that  changes to our “published”-state and choose “Promote post to front page” and “Publish post”. That should do for now. With additional modules you can send emails on certain triggers for example to inform the moderator about unreviewed pages.
    workflowSetTrigger

Step 8: Now comes the (in my eyes) tricky part. Let’s set up permissions.

  1. go to Administer -> User management -> Permissions
  2. check boxes as shown in the screenshot below
    workflowPermissions

Now my knowledge ends. I added two users. One writer and one moderator and tested everything out.

This is what I got:

As a “writer” I see the “workflow summary” so far so good.
workflowWriterSummary

At the bottom of the node form of my first page I find the workflow part as expected. Where I can choose “Draft” or “ready for review”.
workflowWriterDraft

As moderator I can see the “Workflow summary” menu item but nothing  in it. Which is OK, because as long as the page is in “draft”-state the author should be the only one who can view and edit it.

The writer can view and edit his draft after saving it. To change the workflow state he can use the workflow tab or the the workflow part of the page-form. So far so good.
workflowWriterChangingStates

After changing the state to “ready for review”. Except for the changing of the state everything for the writers view is the same. Also OK.

Here the problems start. Our moderator is still not able to view the page. I assume that this is caused by the wrong permissions. To set them right it would be interesting to know. How regular permissions and the permissions in Workflow-module work together. Do I have to grant everything with the regular permissions and restict things with workflow afterwards. Or how is it done?

6 Kommentare »

  1. Haven’t checked to see whether this would work for you, but have you checked out this tutorial?
    http://www.webscaped.com/articles/2008/08/basic-publishing-workflow-with-drupal-6/

    Kommentar by Alozie — 9. Dezember 2009 @ 21:49

  2. Thx.

    By now I have a working setup on a fresh drupal install. I have to test it on the productive site with it’s modules an so on. I hope I’ll get time to do so after christmas.

    If it works out well I’m going to pimp my how to an contribute it to drupal.org like mentioned in one of the comments.

    But again thx for the link.

    Kommentar by Muli — 9. Dezember 2009 @ 23:59

  3. Did you ever get this working? I’m running into the exact same problem and haven’t found a solution yet. I’d love to hear what you finally came up with if you’ve gotten it figured out.

    Kommentar by Jeff — 11. Februar 2010 @ 17:51

  4. I found the solution to this:

    The nodes need to be ‘published’ for other users to be able to see them. If you are using Workflow Access to control visibility by state, this is not a problem (published nodes still won’t show up to users not authorized by Workflow Access).

    Therefore, the sum total of changes to make to your configuration is:

    1. In the ‘Content types’ settings, for the content types affected by the workflow, turn on ‘Published’ under ‘Workflow settings’.

    2. On the workflow Actions page, turn off ‘Publish post’ and ‘Save post’ for the appropriate trigger (Step 7 above).

    Kommentar by Jeffrey Eliasen — 11. Februar 2010 @ 22:16

  5. Thank you very much for your input. Sadly I gave up on workflow and I’m running on modr8 module right now.

    I once got workflow module working but this was only inside a fresh drupal install. The same settings on my running site didn’t work out.

    I sure will try the changes you mentioned above because with workflow module there would be much more things to do than with the quite simple modr8 module (I really like to have drafts ; ). Unfortunately this will take some time. I’m busy with exams at university right now. But perhaps time brings workflow back to my drupal site.

    Kommentar by Muli — 11. Februar 2010 @ 23:55

  6. thanks a lot. the screenshots gave me a brief and complete idea about how does workflow act! and this glance helped me a lot later on a project proposal!

    Kommentar by takpar — 23. Mai 2010 @ 19:17

RSS Feed für Kommentare zu diesem Artikel. TrackBack URL

Hinterlasse einen Kommentar

Powered by WordPress