Skip to main content

hook_form_alter

How to form alter Ubercart 3 Address Pane Fields

I recently needed to alter the address fields within the Ubercart 3 billing pane. Unfortunately, due to the way Ubercart 3 builds these form elements, the standard hook_form_alter() hook was not going to work. After a few hours of searching I finally discovered this post:

https://drupal.org/node/2063949#comment-7750227

With that information I was able to alter my billing pane's company field into a select list taken from a taxonomy. The code below was entered into my theme's template.php file.


Drupal Book Permissions: Only Let Users Add Content to their Own Books

Today's project required me to fine tune Drupal's standard book module. Basically, I needed to limit the choices in the 'Book Outline' area to only display books that the user was the author of. Unfortunately, Drupal's default permissions don't allow for this. Either the user can administer all outlines or none, nothing in between.