function ca_condition_user_roles in Ubercart 6.2
Check a user's roles.
See also
ca_condition_user_roles_form()
2 string references to 'ca_condition_user_roles'
- ca_ca_condition in ca/
ca.ca.inc - Implements hook_ca_condition().
- _ca_convert_conditions in ca/
ca.admin.inc - Helper function for converting Ubercart's Workflow-ng conditions.
File
- ca/
ca.ca.inc, line 404 - This file includes some generic conditions and actions.
Code
function ca_condition_user_roles($account, $settings) {
$settings['roles'] = array_filter($settings['roles']);
if ($settings['operator'] == 'AND') {
foreach ($settings['roles'] as $key) {
if (!isset($account->roles[$key])) {
return FALSE;
}
}
return TRUE;
}
else {
foreach ($settings['roles'] as $key) {
if (isset($account->roles[$key])) {
return TRUE;
}
}
return FALSE;
}
}