Drupal module - Conversion Help

Hi, I have been trying to convert drupal module “Queuenodes per user” from a 6.x module to 7.x, and was hoping someone might be able to help me with the bit’s i’m stuck on, i’ve used the coder module to help with the main chunk of some differences.

[php]function _smartqueue_users_all_eligible_roles($qid = NULL) {
if ($qid) {
$qids = array($qid);
}
else {
// By default we’ll return a list of all roles eligible for any smartqueues.
$smartqueues = db_query(“SELECT qid FROM {nodequeue_queue} WHERE owner = ‘smartqueue_users’”);
foreach ($smartqueues as $smartqueue) {
$qids[] = $smartqueue->qid;
}
}

foreach ($qids as $smartqueue_id) {
$queue = nodequeue_load($smartqueue_id);
if (!empty($queue->roles)) {
$q_roles = $queue->roles;
$roles = array();
//create a normalized roles array
foreach ($q_roles as $key => $rid) {
$roles[$rid] = $rid;
}
}
}
return $roles;
}[/php]

I am getting an error that roles is an undefined variable on the line stating return $roles;

I have uploaded the full code which I have modified so far to

http://codeviewer.org/view/code:1f34

Sponsor our Newsletter | Privacy Policy | Terms of Service