--- modules/rules/rules/modules/views.rules.inc.notyet  1969-12-31 18:00:00.000000000 -0600
+++ modules/rules/rules/modules/views.rules.inc 2009-07-02 19:04:20.000000000 -0500
@@ -0,0 +1,70 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Rules actions for views
+ *
+ * Provides a rules action which renders a view into a variable
+ *
+ * @addtogroup rules
+ * @{
+ */
+
+
+/**
+ * Implementation of hook_rules_action_info().
+ *
+ * Provides a rules action which renders a view into a variable
+ *
+ */
+function views_rules_action_info() {
+
+  $display_id_description = t("To figure out the id of a display, hover your mouse over the tab to select that display. Everything after the '#views-tab-' is t
he id of that display. This ID is guaranteed never to change unless you delete the display and create a new one.");
+
+  return array(
+    'views_rules_action_render_view' => array(
+      'label' => t('Render a View to a variable'),
+      'arguments' => array(
+        'view_name' => array('type' => 'string', 'label' => t('View Name')),
+        'display_id' => array('type' => 'string', 'label' => t('Display ID'), 'description' => $display_id_description),
+        'view_arguments' => array('type' => 'string', 'label' => t('View Arguments')),
+      ),
+      'new variables' => array(
+        'rendered_view' => array('type' => 'string', 'label' => t('Rendered View'))
+      ),
+      'module' => 'Views',
+    ),
+  );
+}
+
+/**
+ * Action Implementation: Render a View
+ *
+ * @param $view_name
+ *   A string containing the name of the view to be rendered
+ * @param $display_id
+ *  A string containing the name of the view's display_id to be rendered (eg. "default" or "page" etc).
+ * @param $view_arguments
+ *  Arguments for the view
+ * @return
+ *  A string containing the rendered view. Depending on the view this might be HTML or text or anything templated
+ */
+function views_rules_action_render_view($view_name, $display_id, $view_arguments) {
+  if ($rendered_view = views_embed_view($view_name, $display_id, $view_arguments)) {
+    
+    // Log successful view rendering only if debug is on
+    if (variable_get('rules_debug', TRUE)) {
+      watchdog('rules', "Rendered view ". $view_name .":". $display_id);
+    }
+    return array('rendered_view' => $rendered_view);
+  }
+  else {
+    // Always log failed rendering
+    watchdog('rules', "View Rendering failed for view ". $view_name .":". $display_id);
+  }
+}
+
+/**
+ * @}
+ */

