hi
please can somebody help?
On a simple workflow(Workbench acces is enable with WM), just after publishing the a node it is no more visible in blocks "All Recent Content" and "My Edit"

But when i set Node permission to "Bypass access control" they are back... please any help on what i am doing wrong ?

Comments

delacosta456 created an issue. See original summary.

agentrickard’s picture

That suggests that another module is denying access to the content. That would typically happen if you have a Node Access module installed. In Drupal 7, common modules for this feature are OG, Groups, Content Access, Taxonomy Access Control. There are several more.

If you can, try using the Devel Node Access module (part of the Devel project) to examine the permissions on the "missing" nodes.

If you can't do that, try to take a look at the database table {node_access}. If there are multiple rows in that table, it would help to know what they are.

delacosta456’s picture

hi agentrickard thansk for replying
Well i can really explain what happen but just after installing this module Workbench Moderation State Permission , i did a drush php-eval 'node_access_rebuild();' and drush rr and everything looks to be normal now as i can see the nodes now.

however another confusion i am in is how to make content follow separate workflow..

What i really mean is : NEW content Workflow and Edition content Workflow

- For A new content will have a logical workflow until revision is publish :
~~~ Draft (Creator)->Needs review(New content Reviewer)->Signature(Master Reviewer)->Publish

- For An existing content , editing it by creating a new draft that will follow another workflow of:

~~~~ Draft(EDITOR) --> need review -->(Edition REVIEWER) ->Publish

Thanks

agentrickard’s picture

So running that node access rebuild confirms what I thought. That's great.

For the other request, each transition has a permission to it, so you likely want to restrict certain transitions to certain roles. However, there is no concept of "different workflow states based on the NEW status of the content" as you describe.

delacosta456’s picture

hi @agentrickard
Restrict certain transitions to certain roles may be a workaround but for a user that has both permissions
the control can not FOR EXAMPLE assure that the user will not do a mistake or intentionally set the state to Draft(EDITOR) for A FRESH because both state will be display to him if he has both permission (if i am not wrong)

Reading a lot of posted issue , truly i have noticed that :

there is no concept of "different workflow states based on the NEW status of the content" as you describe.

However i am just looking for a way to force a "Already published content's" Next "Default Status" to strictly follow transitions after Published (and not display states that have be followed during first publishing workflow)

agentrickard’s picture

I didn't realize it until looking, but you could probably handle that in custom code by using hook_workbench_moderation_states_next_alter() documented in the api file.

In that case you would give all users access to the necessary transition permissions, but remove certain options under some conditions.

delacosta456’s picture

hi @agentrickard
Thanks i was thinking something like that to but not very confortable with code was confuse on were to start from

however if i understand what you are saying (as i have, at least one time in the past, use a hook_form_alter in a module ) this mean hook_workbench_moderation_states_next_alter() i can test the form state and unset[] option..

if i am on the right logic please can you help me by giving me direction in the

code below

of my past's custom module by rewriting it with hook_workbench_moderation_states_next_alter() by supposing that :

-- in WB states are in the order

1.Draft of New content
2.Need review for new content
3Master Validation for for new content
4.Published
5.Draft for Existing content
6.Need review for Existing content
7.Master Validation for Existing content

So transitions available for New content will be only 1-->2-->3-->4 (according to permissions)

And when making a new draft of published content , the custom code , will unset 1, 2, 3 option and make 5, 6 7 available with 5 now being the new initial state.

old module code below

  function dgddi_extras_form_alter(&$form, &$form_state, $form_id) {

      // Expose filter case

        if ($form_id == 'views_exposed_form' && $form_state["view"]->name == "clone_of_co_proj_retraite_test_perf"){

            if ($form['#id'] == 'views-exposed-form-clone-of-co-proj-retraite-test-perf-panel-pane-proj-retra') {
                // test if field exists (if you don't want nasty notice errors)

                if (isset($form['field_date_prv_prof_recrt_value_1_op']['#options'])) {
                    // change operators label
                    $form['field_date_prv_prof_recrt_value_1_op']['#options']['>'] = "Projection après le mois de...(Date Exclu)";
                    $form['field_date_prv_prof_recrt_value_1_op']['#options']['>='] = "Projection à partir du mois de...(Date Inclu)";
                    $form['field_date_prv_prof_recrt_value_1_op']['#options']['='] = "Projection du mois de...(Date Précise)";

                    // remove these operators
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['<']);
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['<']);
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['<=']);
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['not between']);
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['between']);
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['contains']);
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['empty']);
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['not empty']);
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['regular_expression']);
                    unset($form['field_date_prv_prof_recrt_value_1_op']['#options']['!=']);
                }



            }

        }

  }


thanks

agentrickard’s picture

Your statements about hook_workbench_moderation_states_next_alter() are correct. However, the hook_form_alter() code that you posted is not related to Workbench Moderation.

The code you need is something like this:

function dgddi_extras_workbench_moderation_states_next_alter(&$states, $current_state, $context) {
  // For new content, we disallow certain transitions.
  // We don't need to check permissions, since workbench_moderation_states_next() does that 
  // prior to the invocation of this hook.

  // These are the machine_name keys of the disallowed states.
  $disallowed = array(
    'one',
    'two',
  );

  // If creating a new node, remove the disallowed options.
  if ($context['node']->is_new) {
    foreach ($disallowed as $key) {
      if (isset($states[$key])) {
         unset($states[$key]);
      }
    }
  }
}

You will need to change the machine_name keys in the code above, since I don't know what they are.

delacosta456’s picture

Status: Active » Fixed

hi @agentrickard

Many thanks this was exactly what i was looking for.
the hook_form_alter() i posted , i knew wasn't related to workbench moderation ,,, it was just an old form alter code which i was suggesting you to help me modify to achieve what i was looking for about WM.But it doesn't mean anymore now as you have send me a better and shorten code.

Many thanks

agentrickard’s picture

Happy to help. Best of luck.

Status: Fixed » Closed (fixed)

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