Restoring an accidentally deleted Vagrant directory

If you accidentally deleted your Vagrant directory, and you have an orphaned VM sitting in VirtualBox, you can re-associate it with a new VagrantFile. Here's how.

When new VM is first created for a given VagrantFile, Vagrant creates a .vagrant file in the same directory. It contains a JSON array, which stores the Unique ID:

{"active":{"default":"ec426377-dbe6-4be7-4751-766956e44958"}}

You need to re-create this file.

1) Determine the Unique ID for the VM.

Introducing the Unsubscribe module

I recently began sending out mass emails via Drupal, and I was surprised to find that no universal solution existed for providing an "unsubscribe" link on Drupal emails. Sure, you can use Subscriptions to manage actual subscriptions to content, or Notifications for activity notification preferences, but what if you just want to unsubscribe from email communication in general? What if your Drupal admins periodically send out mass emails manually, and you'd like to unsubscribe from even those?

Programmatically render a Drupal view with exposed filters, arguments, etc.

Embedding a view programmatically is not too difficult, but what about passing it a value for an exposed filter? This snippet gives a simple example of how to modify the View object in a more meaningful way before rendering it.

<?php
$name = 'my_view';
$display = 'block_1';
$view = views_get_view($name);
$view->set_display($display);
?>

If you'd like to pass in exposed filter values, define these properties before calling $view->preview():