Drupal Rules Domain access condition
Posted:
Notice: This article does not advocate the use of PHP eval(), but it was the fastest way to get done what I needed :)
Yesterday I needed a condition to ensure that a rule executed on one particular domain of a site running Domain access. The Domain module doesn't seem to provide a Rules condition, and a super quick search of Google didn't find one either.
In order to solve my problem I could either write a custom module that makes a Rules condition available, using hook_rules_condition_info(), or use the Execute custom PHP code condition, I chose the easy path.
The value I used for the code in the condition was:
$domain = domain_get_domain();
if (!empty($domain['domain_id']) && $domain_['domain_id'] == 3) {
return TRUE;
}
return FALSE;