Details
-
Type:
Bug
-
Status: Done/Fixed
-
Priority:
Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.0
-
Fix Version/s: 2.1
-
Component/s: Core CiviCRM
-
Labels:None
Description
As noted above the function:
- Note that we ignore the edit field and do not follow the drupal protocol
- of extracting values from the edit field. We extract the fields directly
- from $_POST. This is because the underlying form package that we use
- (HTML_QuickForm) does the form value extraction and validation.
However this incorrectly assumes that the use object is only modified via the user account form. Several modules modify the user object directly via user_save. CiviCRM's implementation of hook_user does not follow the rules for the $edit argument, and thus does not update the email address when altered programatically (without the account form).
Sorry, I incorrectly used the clone method.
I wanted to re-open this issue, since there is still a problem with the implementation of hook_user. On the $op == 'form' part of the hook, the civicrm_user function is incorrectly trying to output a form for /all/ modules that implement this hook:
<code>
{ return civicrm_form_data($edit, $user, $category, true, false ); }case 'form':
// only return a form to drupal my account page
if ( arg(0) == 'user' &&
arg(2) == 'edit' &&
arg(3) ) {
if ( empty( $_POST ) )
else
{ return civicrm_form_data($edit, $user, $category, true, true ); }}
break;
</code>
This hook should only return a form for categories that civicrm knows about. As it is, it results in errors for any other module trying to output a form here.