Just another quick snippet to add to the Grasmash Services archive.
This will allow you to POST an email address to /your_endpoint/user/password_reset and trigger a 'Forgot Password' email to be sent to the appropriate user.
This is mostly a note to myself. When calling the user.register method for the Services module, the JSON data format is a little wonky:
Everyone loves the Services module. It allows you to easily create API endpoints for Drupal's core features, permitting you to interact with Drupal from external applications. It also very easily extended.
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?
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():
If you find that, after SSHing to a remote linux server, the command line readout is not in English, you can easily set the language for your particular user.
Enter the following line in ~/.bash_profile:
After saving, reload the file:
Hope that helps someone! I'm sure I'll be referencing this page in the future.