You are here

function smartqueue_author_nodequeue_subqueues in Nodequeue 5.2

Implementation of hook_nodequeue_subqueues()

File

./authorqueue.module, line 54

Code

function smartqueue_author_nodequeue_subqueues(&$queue, $node) {

  // Sorry, no anonymous nodes allowed.
  if (empty($node->uid)) {
    return;
  }
  $rids = !empty($queue->reference) ? explode('-', $queue->reference) : array();
  $account = user_load(array(
    'uid' => $node->uid,
  ));
  if (!empty($rids) && !array_intersect($rids, array_keys($account->roles))) {
    return;
  }
  if (!nodequeue_load_subqueues_by_reference(array(
    $queue->qid => array(
      $node->uid,
    ),
  ))) {
    nodequeue_add_subqueue($queue, $account->name, $node->uid);
  }
  return array(
    $node->uid,
  );
}