Here is how to make sure your hook_form_alter is called after another modules hook_form_alter:
/**
* Implements hook_form_alter().
*/
function my_module_form_alter(&$form, &$form_state, $form_id) {
// do your stuff
}
/**
* Implements hook_module_implements_alter().
*
* Make sure that our form alter is called AFTER the same hook provided in xxx
*/
function my_module_module_implements_alter(&$implementations, $hook) {
if ($hook == 'form_alter') {
// Move my_module_rdf_mapping() to the end of the list. module_implements()
// iterates through $implementations with a foreach loop which PHP iterates
// in the order that the items were added, so to move an item to the end of
// the array, we remove it and then add it.
$group = $implementations['my_module'];
unset($implementations['my_module']);
$implementations['my_module'] = $group;
}
}
This also works when the other module has provided a form_alter hook in the variation: hook_form_FORM_ID_alter. (they explain that in the documentation: hook_module_implements_alter).
I know that this post is quite similar to wiifm's post, but thought it useful with an example with hook_form_alter