Tag Archives: Views

Drupal – Send mass email to node email field using Views Send module

The Views Send module integrated with Drupal Views such that you can select a group of email addresses with the Views filter and then send a batch of emails.

1. Download and enable the Views Send module module.

2. Create a new user view in Table format.

3. Add the User: E-mail as well as the Global: Send e-mail field.
Continue reading Drupal – Send mass email to node email field using Views Send module

Drupal 7 – Export data using Views data export module with Drush command

Yesterday we talked about exporting data using the Views data export module.
Drupal 7 – Export view data CSV, XML, XLS by Views data export module

The module also provides a Drush command such that you can run the export command in the server which is convenient for backend integration.

The following command is stated in the project page.

  • drush views-data-export [view-name] [display-id] [output-file]

Continue reading Drupal 7 – Export data using Views data export module with Drush command

Drupal 7 – Render a view with contextual filter argument programmatically

Some days ago, i write a blog post about how to render a Drupal 7 block programmatically.
Drupal 7 – Render a Block programmatically

If the block is created by Views, there is a simpler solution provided by the Views API. And we can also pass the contextual filter argument too.

print views_embed_view(<view machine name>, <display id>, <arg 1>);

 

Done =)

Reference: Outputting a Drupal 7 View programmatically with Contextual Filters (arguments)

Drupal 7 – Render Views Exposed Filter programmatically

Update at 2014-09-18: An simpler way to do that is to enable the Exposed form in block in the view settings and then render the block as suggested by plano.com.

The following piece of code render the Views Exposed Filter.

$view = views_get_view('<view name>');
$display_id = 'page';
$view->set_display($display_id);
$view->init_handlers();
$form_state = array(
  'view' => $view,
  'display' => $view->display_handler->display,
  'exposed_form_plugin' => $view->display_handler->get_plugin('exposed_form'),
  'method' => 'get',
  'rerender' => TRUE,
  'no_redirect' => TRUE,
);
$form = drupal_build_form('views_exposed_form', $form_state);
print drupal_render($form);

 

Done =)

Reference:

Drupal 7 – Update multiple nodes at once in a Views

Sometimes we may want to update multiple nodes at once. Views Bulk Operations may help if you want to set the same value for a field of multiple nodes. But if you want to set different values among a set of nodes, then Views Bulk Operations could not help.

In Drupal 6, the Editview module may help but unfortunately there is no Drupal 7 version. An alternative solution could be done by editablefields module.

1. Download and enable the module. (I used the 7.x-1.x-dev version)

2. Create a view with table format. (This is not necessary but better user interface)
Continue reading Drupal 7 – Update multiple nodes at once in a Views

Drupal 7 – Customize the exposed filter selection list

Yesterday we have talked about how to use selection list for selecting Entity reference in Views exposed filter.
Drupal 7 – Selection list for Entity reference in Views exposed filter

Now i want to have more control on the selection list. For example, i have a content type called competition and i want to limit the number of options in the Entity reference selection list. In this case, we have to create a custom module and alter the views_exposed_form.
Continue reading Drupal 7 – Customize the exposed filter selection list