function regcode_roles_get_rules in Registration codes 6
Same name and namespace in other branches
- 6.2 regcode_roles/regcode_roles.module \regcode_roles_get_rules()
- 7.2 regcode_roles/regcode_roles.module \regcode_roles_get_rules()
- 7 regcode_roles/regcode_roles.module \regcode_roles_get_rules()
List all of the regcode rules
2 calls to regcode_roles_get_rules()
- regcode_roles_get_list_markup in regcode_roles/
regcode_roles.module - Return the formatted HTML list
- regcode_roles_regcode_used in regcode_roles/
regcode_roles.module - Implements hook_regcode_used()
File
- regcode_roles/
regcode_roles.module, line 207
Code
function regcode_roles_get_rules($category = '') {
// Query
$query = 'SELECT id, category, regcode_roles.role AS rid, role.name AS role, expire_date, expire_duration
FROM {regcode_roles} AS regcode_roles LEFT JOIN {role} AS role
ON (regcode_roles.role = role.rid)';
if (empty($category)) {
$res = db_query($query);
}
else {
$res = db_query($query . " WHERE category='%s'", $category);
}
// Build array
$rules = array();
while ($row = db_fetch_array($res)) {
$rules[] = $row;
}
return $rules;
}