You are here

function webform_rules_submissions_load in Webform Rules 7

Rules action to load a list of webform submissions.

Parameters

int $nid: ID of node to load the submissions for.

int $sid: (optional) Submission ID.

Return value

array List of loaded webform submissions.

1 string reference to 'webform_rules_submissions_load'
webform_rules_rules_action_info in ./webform_rules.rules.inc
Implements hook_rules_action_info().

File

./webform_rules.rules.inc, line 404
Functions for rules integration.

Code

function webform_rules_submissions_load($nid, $sid = NULL) {

  // Make sure the needed functions are available.
  module_load_include('inc', 'webform', 'includes/webform.submissions');
  $filters = array(
    'nid' => $nid,
  );
  if (!empty($sid)) {
    $filters['sid'] = $sid;
  }

  // Fetch submissions.
  $submissions = webform_get_submissions($filters);
  return array(
    'submissions' => $submissions,
  );
}