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?
Trust him not with your secrets, who, when left alone in your room, turns over your papers.
Lavater, Johann Kaspar
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.
Learning to use the Views module from the front end of Drupal is a daunting task, but you can rest assured that many others struggle along with you. There are many tutorials and screencasts dedicated the the subject. Tackling the Views API from the backend, however, is a bit more of a challenge. It's not easy to document the behemoth that is Views, and hence, the documentation is limited.
Here's a bit of an esoteric issue that was a bit tricky to hunt down. I hope that this blog post helps the few people out there that it applies to!
You've got a secure (https) Drupal site, and you'd like it to contain facebook-compatible, open graph meta tags. So, you download the meta tags module and do some configuration magic. Everything looks good until you post a page on Facebook, and the image doesn't work!