我需要使用Drupal6的“hook\u user”来更新第三方API,只要用户更新他们的配置文件。
也就是说,用户更新用户名,但是如果API失败,就阻止Drupal更新本地记录。
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;
}
}
目前,返回false并不能停止执行。