3

I am using Using Workbench for content moderation and Workbench Access for access control.

Is it possible to use the rules integration to send an email to all of those users who are in a content node's editorial access control?

The screenshot shows what I've currently got, which is sending the notification to one particular email address on state change to Needs review.

enter image description here

  • 1
    What exactly is the "editorial section"? – mpdonadio Jan 30 '13 at 12:56
  • I mean the Workbench access section. I personally prefer to call it the editorial group. – Dylan Spencer James Jan 30 '13 at 13:44
2

I don't know what the "editorial access control" is but if you don't find any easier solution you can always write your own rules action for generating the list of people you need. In my case I am sending a message to the reviewers that are provided in one of the fields of the content. It should be easily adaptable to any other porpoise.

/**
 * Implements hook_rules_action_info().
 */
function mymodule_workflow_rules_action_info() {
  $items = array();
  $items['mymodule_workflow_reviewers'] = array(
    'label' => t('Get reviewers'),
    'group' => t('Windbench'),
    'parameter' => array(
        'node' => array('type' => 'node', 'label' => t('Node')),

    ),
    'provides' => array(
      'reviewers' => array('type' => 'list<user>', 'label' => t('List of reviewers')),
    ),
  );
  return $items;
}
function mymodule_workflow_reviewers($node){
  $reviewers = array();
  foreach($node->field_workflow_reviewers['und'] as $reviewer){
    $reviewers[] = user_load($reviewer['uid'],true);
  }
  return array('reviewers' => $reviewers);
}

And then use that action in your rules enter image description here

  • Thanks for your reply. Will try doing something like that. Just wondering though, can't you already access people on a node using a user reference field? I've managed to do that, but I want to access the node's workbench section, which doesn't seem to be available... – Dylan Spencer James Jan 30 '13 at 16:55
  • Any idea how I would use your example to return a taxonomy term object from a taxonomy id. I've tried taxonomy_term_load but it doesn't seem to work. – Dylan Spencer James Jan 31 '13 at 11:00
  • It would be better if you could give the code that is not working. My guess is that whatever taxonomy_term_load is returning is not a user object type. Note that in my example I return an array of user objects that I load based on their ID-s. ("$reviewers[] = user_load($reviewer['uid'],true);") – Pawel G Feb 4 '13 at 10:47
0

You could try this sandbox project Workbench Notify

Workbench Notify enables to automatically notify the editors as previously specified and individually defined in the Workbench Access's menu Editorial assignments by editor or defined by their role in the Workbench Access's menu Editorial assignments by role, on a transition state set in Workbench Moderation. For the individually defined editors, notifications will be sent only to the editors (or users) whose roles are configured accordingly in the settings of Workbench Notify.

Workbench Notify works with a taxonomy or menu scheme set for Workbench Access.

Or use the snippet PHP you can find in this blog post Workbench Access et Rules - Notifier les modérateurs d'une nouvelle contribution

0

There's an Action "Send mail to all users of a role". Provided you have a role specifically for editorial control, that may solve this in a simple manner.

If you have a more complex review workflow (eg only a Senior Reviewer from the author's specific regional office may review their input) then you need custom code like that in Pawel's answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.