Hi,

I am not sure if this request belongs here but will appreciate any leads that you are able to provide.

I have some blocks that I want to be visible only in the first state of the node & then disappear when the state changes.

Any ideas on how I may achieve this ?

Many Thanks

CommentFileSizeAuthor
#1 wfblockjv.png33.47 KBjvandyk

Comments

jvandyk’s picture

StatusFileSize
new33.47 KB

In Administer / Site building / Blocks, under "Page specific visibility settings", choose "Show if the following PHP code returns TRUE". Then enter the following:

$state_id = 2;
return isset($node->_workflow) && ($node->_workfow == $state_id);

See attached screenshot.

Substitute the state ID of the first state of your workflow (you can find out the state ID by going to Administer / Site building / Workflow and clicking on the Edit button next to the state you are interested in; the state ID will be the last part of the URL).

newdru08’s picture

Thanks - but this didn't work. This removed the block from all workflow states of the node.

Anonymous’s picture

There are two reasons this snippet did not work:

  1. There is no $node in the context of a block without prior work (i.e. create a $node variable from the path arguments)
  2. There is a typo in the second conditional: $node->workfow is missing an 'l'
Bastlynn’s picture

Status: Active » Fixed

Hi,

With the release of Drupal 7, Drupal 5 is no longer receiving security updates, reviews, or development from many contributed modules. Since 5 is now considered a depreciated version, you really should seriously look into upgrading to Drupal 6 or 7. The newer versions of Drupal work better, have more support, and will be safer (literally! security patches!) for your website. We are currently working on a new release for Workflow to Drupal 7. In light of that, further support for Drupal 5 issues is infeasible at the moment. Please consider upgrading to Drupal 6 or 7 in the near future - you'll be glad you did.

- Bastlynn

Aside from that - you may consider pulling the node id from your URL on the display page. That will give you the nid, then you can load the node and pull the workflow data from that. Otherwise, I really do strongly recommend you update to 6 or 7.

Bastlynn’s picture

Status: Fixed » Closed (won't fix)