I need to use Drupal 6 "hook_user" to update a third-party API whenever a user updates their profile.
Therefore, I use the operation "update". The problem I am facing is that I simply cannot figure out how I can stop execution if the update to the third-party API has failed.
those. the user updates his username, but if the API fails, prevent Drupal from updating the local record.
function myhooks_user($op, &$edit, &$account, $category) {
switch ( $op )
{
case 'update':
if ( FALSE === updateAPI($data) )
{
drupal_set_message("Cannot update user information", "error", false);
return false;
}
break;
}
}
Returning false currently does not stop execution.
source
share