I hope I am missing some fundamental concept of this module, since I don't seem to get it to work. Ultimately what I want to achieve is some mechanism to (un)publish nodes based on taxonomy or cck-fields, but I try to start simple.

I took a stock Drupal 5.2 install and added only the Workflow-ng 5.x-1.0 and Token 5.x-1.8 modules
I changed the Page-contenttype to be unpublished by default
I added a new workflow-ng configuration:
event: content is going to be saved
condition: content-type=page
action: publish content

I expected to see every page that I saved to automagically get to published state. But alas, no change to the published state. Pretty vague is whether I have to select 'content' or 'unchanged content' on the action page, but this also does not seem to have any effect. I also tried playing with 'promote to front page' and 'change content author' but these also don't work.

Is this a bug or am I missing something crucial?

Comments

amitaibu’s picture

I'm not sure about the bug, but why don't you set in the admin/content_type/page the defualt to 'publish', and 'promote to front page'?

toniw’s picture

I don't set it default to 'published' because I want to use the workflow mechanism to decide whether the page should be published based on taxonomy and/or cck-fields. That would mean adding some 'condition' logic. But if the above simplified scenario does not work, the complex one with additional conditions will certainly also fail...

fago’s picture

yep, that sounds useful. have you activated the 'publish' checkbox in the action's confiugration form?
Please verify this, otherwise please export your configuration and post it, so I can try to reproduce the problem.

toniw’s picture

Yep, I have activated the publish-checkbox. I have also tested with arguments configuration: content='content' and content='unchanged content' (are those the before and after state of the node?). No setting whatsoever seems to make my page go published.
This is the exported config:

array (
  'cfg_1' => 
  array (
    '#type' => 'configuration',
    '#altered' => false,
    '#event' => 'node_submit',
    '#label' => 'gopublish',
    '#active' => 1,
    '#module' => 'workflow-ng',
    0 => 
    array (
      '#type' => 'action',
      '#name' => 'workflow_ng_action_node_publish',
      '#settings' => 
      array (
        'published' => 1,
      ),
      '#label' => 'Publish/unpublish content',
      '#argument map' => 
      array (
        'node' => 'node',
      ),
    ),
    '#description' => NULL,
    '#attributes' => 
    array (
    ),
    '#required' => false,
    '#tree' => false,
    '#parents' => 
    array (
    ),
    '#recursion' => false,
    '#fixed' => false,
    '#execute' => 'workflow_ng_execute_configuration',
    '#process' => 
    array (
      'workflow_ng_ui_prepare_configuration' => 
      array (
      ),
    ),
    '#_defaults_applied' => true,
    '#name' => 'cfg_1',
  ),
)
fago’s picture

(are those the before and after state of the node?) - yes!

hm, I've tested your configuration and it is working fine for me! I've tested it with the page content type, with manual setting the node unplublished -> it got published. Then I'll tested with default == unpublished -> it got published. Then I'll tested the same as not admin user and it got published.

So strange that it doesn't work for you!? Perhaps you can try upgrading to the latest -dev snapshot as I've used that - although I can't think of any changes that should affect this.

Or perhaps you have any other modules active that might interfere?

toniw’s picture

I just threw away the drupal webdir and content of the database and did the whole exercise again, but still can't get it to work...

I did this:

  • installed plain drupal-5.3
  • created the admin account
  • created a test page
  • installed and enabled token-5.x-1.x-dev (dd 22 oct)
  • installed and enabled workflow_ng-5.x-1.x-dev (dd 04 oct)
  • modified default published state of 'page' to 'not published'
  • added a new workflow-ng config, to publish the node on event 'content is going to be saved' (same as described earlier)
  • created a new page, saved it

The node will not get published, not matter what I do.
I have not installed any other modules and I have used the latest dev versions of the two modules involved. I must be overlooking something.

If you wish I can give you admin-access to the test-server on which I am doing this, to rule out that this is a user-error...

fago’s picture

hm, are you using php4?

toniw’s picture

Yup... PHP 4.4.4

fago’s picture

puh, there was an issue with the automatic saving of arguments. It's not working with php4 or non-objects. I've improved workflow-ng to detect this situation, so that it saves the changes itself in this cases.

Please upgrade to the latest -dev snapshot and try again. Now the nodes should be published for you too. Unfortunately now the node is saved two times for you. However I fear that this might lead to the creation of two nodes. Please test!

Hmm, I think I have to find a better solution or this issue :/

fago’s picture

so, I've removed my first fix and replaced it by a better one. Now, the node will be only saved once again for php4 users too - as it should be. Again, please test the dev snapshot and report if it works for you.

If not, try changing the line
function workflow_ng_action_node_publish($node, $settings, &$arguments, &$log) {
to
function workflow_ng_action_node_publish(&$node, $settings, &$arguments, &$log) {
in
workflow_ng_events.inc

thanks

toniw’s picture

I've pulled workflow_ng_events.inc and workflow_ng.module from CVS and dropped them into place.
First quick test shows that this indeed seems to fix the problem! I will do some more thorough testing on more 'real' configurations later this week. Keep you posted. Thank you for your effort!

toniw’s picture

Ow... I'm now trying to build my workflow decision based on taxonomy using the token-module, but it seems like changes in taxonomy are not properly reflected in [node_unchanged:term] and [node:term] in the content-is-going-to-be-saved event. Is that a problem of the workflow_ng module or the token module?
Looks a lot like the content-has-been-created and content-has-been-updated are better candidates to build my config on, although that would mean duplicating all rules.
Oh... and now I see that content-has-been-updated is also fired after I let workflow_ng modify the node in the content-has-been-created event...

fago’s picture

Status: Active » Fixed

yes, there are some problems parsing taxonomy terms with token, e.g. see http://drupal.org/node/137669

Probably, it's more safe to use Content has been inserted/updated, yes. It's a bit awkward, that the configuration is evaluated two times no node creation time.. One solution would be to use a condition to check if the node is already published, however there is no token for that.

The better solution would be to support assigning two events (with identical arguments) to a configuration. Workflow-ng avoids the recursive execution of the same configuration, so this would help here too.

However I've just improved the node published and promote actions to only cause content saving when they are actually changing something. So it doesn't matter that much, if you run the configuration two times, as the node will be only saved when necessary.

Thanks for testing.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.