drupal 6.x

Drupal Webform Submission Results User Access Control

Have you ever wanted to grant access to a certain list of users so they could access a Drupal Webform's submission results? The default permissions that come with Webform don't provide much granularity in this scenario, so a custom solution needs to be implemented.

Luckily Webform has a few hooks to make our lives easier.

Drupal Convert User Relationships Module to User Reference Field

So I was using the User Relationships module for a while on a project. It worked OK, but I got very tired of not having the flexibility of a user reference field. Since I was already using the Content Profile module for users, I just added a new user reference field to the Profile content type. The user reference field was configured for multiple values.

I then wrote a simple hook_menu item and a call back function that would actually handle the conversion from the User Relationships module to a User Reference field on my Content Profile setup.

Drupal Webform Alter

Once upon a time, on a dark day, December 21st, 2011 to be exact. There was a desire to modify a Drupal webform. Normally, one could use replacement pattern tokens available in the Webform UI to set default values on a component field. But this was a special day, a day where a Webform field had to be prepopulated with a value that was not available via replacement pattern tokens. So if you need to modify a Webform via hook_form_alter, try something like this:

Drupal Location Form Alter

If you need to modify the Location module's form on a node, try something like this:

Drupal - Handle Existing Webform Submission Edits

If you need to do something when a user edits/updates a previous webform submission, try something like this:

Drupal JSON Services Examples with PhoneGap and JQuery Mobile for Android

UPDATE: Please read this article for a much more detailed explanation on how to get PhoneGap up and running to communicate with Drupal Services.

Custom Breadcrumbs in Drupal

Aside from the handy dandy Custom Breadcrumbs module and/or using Views arguments to set your breadcrumb, sometimes you just want to set a breadcrumb programmatically on a certain url menu path with phptemplate_breadcrumb, here's how, right now:

Drupal CCK FileField (ImageField) Permissions Granularity

So I had a content type with an optional, unlimited value Imagefield attached to it. The content type's user permissions where set to allow all authenticated users to edit any node of that type. Which is all fine and dandy like sour candy. However, by default users are able to edit and/or remove other user's images in that field. Out-of-the-box that is the intended functionality, but I wanted user's images to be protected from other users. Here is how it can be done with a module:

Drupal URL Arguments in Javascript

Sometimes a prerequisite to getting a burrito for lunch involves using Drupal URL arguments in Javascript. So for example, say you had a URL like this:

http://www.tylerfrankenstein.com/chicken/burrito/combo

You can add code like this to your module:

function my_module_init () {
  drupal_add_js(array('arg' => arg()),'setting');
}

And finally you can use code like this in Javascript to use the Drupal URL arguments:

Pages

Subscribe to RSS - drupal 6.x