You are here

function workflow_transition_delete_role in Workflow 5.2

Same name and namespace in other branches
  1. 5 workflow.module \workflow_transition_delete_role()
  2. 6.2 workflow.module \workflow_transition_delete_role()
  3. 6 workflow.module \workflow_transition_delete_role()

Remove a role from the list of those allowed for a given transition.

Parameters

int $tid:

mixed $role: Int (role ID) or string ('author').

1 call to workflow_transition_delete_role()
workflow_update_transitions in ./workflow.module
Update the transitions for a workflow.

File

./workflow.module, line 1291

Code

function workflow_transition_delete_role($from, $to, $role) {
  $tid = workflow_get_transition_id($from, $to);
  if ($tid) {
    $roles = db_result(db_query("SELECT roles FROM {workflow_transitions} WHERE tid=%d", $tid));
    $roles = explode(',', $roles);
    if (($i = array_search($role, $roles)) !== FALSE) {
      unset($roles[$i]);
      db_query("UPDATE {workflow_transitions} SET roles='%s' WHERE tid=%d", implode(',', $roles), $tid);
    }
  }
}