You are here

function rb_misc_action_views_result_count in Rules Bonus Pack 6

Same name and namespace in other branches
  1. 7 rb_misc.rules.inc \rb_misc_action_views_result_count()

The 'rb_misc_action_views_result_count' condition.

File

./rb_misc.module, line 213
Miscellaneous conditions and actions for Rules.

Code

function rb_misc_action_views_result_count($settings) {
  $views_settings = explode('|', $settings['view']);
  $view_name = $views_settings[0];
  $display_name = $views_settings[1];
  $view_arguments = explode("\r", $settings['args']);
  $view = views_get_view($view_name);
  $view
    ->set_display($display_name);
  $view
    ->set_arguments($view_arguments);
  $view
    ->set_items_per_page(0);
  $view
    ->execute();
  $results = $view->result;
  return count($results) >= $settings['minimum'];
}