diff --git a/course_credit.module b/course_credit.module index a52e77e..22ff2ab 100644 --- a/course_credit.module +++ b/course_credit.module @@ -783,7 +783,7 @@ function course_credit_settings_form() { $form['course_credit_open_claim'] = array( '#type' => 'checkbox', '#title' => t('Skip eligibility checks'), - '#description' => t('Mapping will not be used to determine eligibility. Users can claim any active credit type.'), + '#description' => t('Profile mapping will not be used to determine eligibility. Users can claim any active credit type. Select this if you are using Rules for eligibility.'), '#default_value' => variable_get('course_credit_open_claim', 0), ); @@ -1321,7 +1321,6 @@ function course_credit_user_credit_types($node, $account) { if ($open_claim) { // Credit claim is open. User is eligible for all active types. $valid_credit_instances[$ct_instance->type] = $ct_instance; - continue; } // If credit type is active, try mappings. @@ -1353,15 +1352,16 @@ function course_credit_user_credit_types($node, $account) { } } - // Try rules. Rules overrides any result of a credit mapping. + // Rules cannot grant eligibility, only take it away. To use rules fully + // similar to the way Commerce/Ubercart payment conditions work, make sure + // "open claim" is set. if ($set = rules_config_load("course_credit_eligibility_{$ct_instance->type}")) { - if ($set->property('children')) { - if (!$enrollment) { - $enrollment = new stdClass; - } - if (!$set->execute($ct_instance, $account, $enrollment)) { - unset($valid_credit_instances[$ct_instance->type]); - } + if (!$enrollment) { + $enrollment = new stdClass; + } + if (!$set->execute($ct_instance, $account, $enrollment)) { + // The rule did not pass. Remove the credit type from eligbility. + unset($valid_credit_instances[$ct_instance->type]); } } }