Rules Custom Condition for registration capacity I am trying to learn Rules and adding a custom condition. I need help to figure out what I am doing wrong.

My Condiiton set up:

function rules_example_capacity_condition_info() {
   $conditions = array(
     'rules_example_action_count_capacity' =&gt; array(
       'label' =&gt; t('Print capacity count on page'),
       'group' =&gt; t('Rules examples'),
       'parameters' =&gt; array(
         'count' =&gt; array('type' =&gt; 'value', 'label' =&gt; t('registration event count')),
         'capacity' =&gt; array('type' =&gt; 'value', 'label' =&gt; t('registration event capacity')),         
         ),
       ),
     );
     return $conditions; 
 }


and the function that calls it...

function rules_example_action_count_capacity($count, $capacity) {
    $reg_count = reg_count_load($count);
    return($reg_count-&gt;capacity == $capacity) ? true : false;
}  


I am trying to determine the count (how many people have registered so far) and the capacity. When the count and capacity are the same send an email.

I am not a developer so this is a little bit of a struggle. I found this series (http://nodeone.se/node/28) which is helpful, however there are so many smaller things I might be missing. Please help if you can. I am hoping that this will help more then just myself.

Thanks
Tim
Looking at your function, I believe you need to rename it to something like mymodule_rules_condition_info. The hook you are trying to implement is hook_rules_condition_info(). Did you find that your custom condition was showing up when you were editing a rule?

function MYMODULE_rules_condition_info() {
   $conditions = array(
     'mymodule_event_is_at_capacity' =&gt; array(
       'label' =&gt; t('Event has reached maximum registrations'),
       'group' =&gt; t('MY MODULE'),
       'parameters' =&gt; array(
         'registration' =&gt; array(
            'type' =&gt; 'registration',
            'label' =&gt; t('The registration event'),
           ),         
         ),
       ),
     );
     return $conditions; 
 }


Semantically you may want to call your condition 'mymodule_event_is_at_capacity' and it should only need one parameter which is the capacity that you will provide in the Rules UI.

The function you will be writing mymodule_event_is_at_capacity($capacity) will query for the number of (active) users in Drupal, and if it is greater than or equal to $capacity, it will return TRUE.

All of this can be kicked off by add a new Rule that reacts on the "After saving a new user account" event.