How to add a validation function before the one set by core or other modules

Make sure you module wight in the system table are higher than the modules you want to override.

<?php

//in form_alter hook

$temp_form = $form['#validate'];
unset(
$form['#validate']);
$form['#validate'][] = "my_validation_function";
foreach (
$temp_form as $id => $val_func) {
   
$form['#validate'][] = $val_func;
}
?>
Knowledge keywords: