Closed (won't fix)
Project:
Rules
Version:
6.x-1.x-dev
Component:
Rules Core
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Mar 2012 at 11:56 UTC
Updated:
1 Jun 2012 at 18:07 UTC
I'm trying to add more rules support to the role expire module but I seem to be hitting a brick wall with how to structure both the event and condition.
I have the following:
rules_invoke_event('event_role_expire_expire_user', $account, $expire['rid']);
This passes the user object and role id of the role that has been removed from the user
function role_expire_rules_event_info() {
return array(
'event_role_expire_expire_user' => array(
'label' => t('User of role x is expired'),
'module' => 'Role expire',
'arguments' => array(
'user' => array('type' => 'user', 'label' => t('User who is expired')),
'oldrid' => array('type' => 'number', 'label' => t('RID of role being expired')),
'newrid' => array('type' => 'number', 'label' => t('RID of role being expired')),
),
),
);
}This event should pass the oldrid (which is passed in from rules_invoke_event() I think) to the following condition:
function role_expire_rules_condition_info() {
return array(
'role_expire_condition_expire_user' => array(
'label' => t('Role ID Check'),
'arguments' => array(
'user' => array('label' => t('user'), 'type' => 'value'),
'oldrid' => array('label' => t('Role ID to check against'), 'type' => 'number'),
'newrid' => array('label' => t('Role ID to check against'), 'type' => 'number'),
),
'help' => t('Check expired role for predetermined role'),
'module' => 'Role expire',
),
);
}
function role_expire_condition_expire_user($user, $oldrid, $newrid) {
//var_dump($user);
var_dump($oldrid);
var_dump($newrid);
if ($newrid == 10000000000) {
return TRUE;
}
else {
return FALSE;
}
}
The rid set in the condition is available in the check but the rid of the role removed isn't. Can someone point me in the right direction? I've checked through the documentation and can't see a way of doing this.
Comments
Comment #1
mitchell commentedThank you for submitting a support request / issue for Rules 1. Sorry it was not attended to earlier; I hope you found the information you were seeking in another resource, such as the Rules Drupal 6 documentation.
Because it has been a while since it was first submitted, I'm closing it to clear up space. However, if you would still like to submit another support request or help answer others support requests, your efforts would be welcomed and appreciated.