Révision b4adf10d
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/modules/user/user.module | ||
---|---|---|
501 | 501 |
file_usage_delete($account->original->picture, 'user', 'user', $account->uid); |
502 | 502 |
file_delete($account->original->picture); |
503 | 503 |
} |
504 |
// Save the picture object, if it is set. drupal_write_record() expects |
|
505 |
// $account->picture to be a FID. |
|
506 |
$picture = empty($account->picture) ? NULL : $account->picture; |
|
504 | 507 |
$account->picture = empty($account->picture->fid) ? 0 : $account->picture->fid; |
505 | 508 |
|
506 | 509 |
// Do not allow 'uid' to be changed. |
507 | 510 |
$account->uid = $account->original->uid; |
508 | 511 |
// Save changes to the user table. |
509 | 512 |
$success = drupal_write_record('users', $account, 'uid'); |
513 |
// Restore the picture object. |
|
514 |
$account->picture = $picture; |
|
510 | 515 |
if ($success === FALSE) { |
511 | 516 |
// The query failed - better to abort the save than risk further |
512 | 517 |
// data loss. |
... | ... | |
589 | 594 |
user_module_invoke('insert', $edit, $account, $category); |
590 | 595 |
module_invoke_all('entity_insert', $account, 'user'); |
591 | 596 |
|
592 |
// Save user roles. |
|
593 |
if (count($account->roles) > 1) { |
|
597 |
// Save user roles. Skip built-in roles, and ones that were already saved |
|
598 |
// to the database during hook calls. |
|
599 |
$rids_to_skip = array_merge(array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID), db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol()); |
|
600 |
if ($rids_to_save = array_diff(array_keys($account->roles), $rids_to_skip)) { |
|
594 | 601 |
$query = db_insert('users_roles')->fields(array('uid', 'rid')); |
595 |
foreach (array_keys($account->roles) as $rid) { |
|
596 |
if (!in_array($rid, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) { |
|
597 |
$query->values(array( |
|
598 |
'uid' => $account->uid, |
|
599 |
'rid' => $rid, |
|
600 |
)); |
|
601 |
} |
|
602 |
foreach ($rids_to_save as $rid) { |
|
603 |
$query->values(array( |
|
604 |
'uid' => $account->uid, |
|
605 |
'rid' => $rid, |
|
606 |
)); |
|
602 | 607 |
} |
603 | 608 |
$query->execute(); |
604 | 609 |
} |
... | ... | |
2633 | 2638 |
$account->content = array(); |
2634 | 2639 |
|
2635 | 2640 |
// Allow modules to change the view mode. |
2636 |
$context = array( |
|
2637 |
'entity_type' => 'user', |
|
2638 |
'entity' => $account, |
|
2639 |
'langcode' => $langcode, |
|
2640 |
); |
|
2641 |
drupal_alter('entity_view_mode', $view_mode, $context); |
|
2641 |
$view_mode = key(entity_view_mode_prepare('user', array($account->uid => $account), $view_mode, $langcode)); |
|
2642 | 2642 |
|
2643 | 2643 |
// Build fields content. |
2644 | 2644 |
field_attach_prepare_view('user', array($account->uid => $account), $view_mode, $langcode); |
... | ... | |
3773 | 3773 |
// inside the submit function interferes with form processing and breaks |
3774 | 3774 |
// hook_form_alter(). |
3775 | 3775 |
$form['administer_users'] = array( |
3776 |
'#type' => 'value',
|
|
3777 |
'#value' => $admin,
|
|
3776 |
'#type' => 'value', |
|
3777 |
'#value' => $admin, |
|
3778 | 3778 |
); |
3779 | 3779 |
|
3780 | 3780 |
// If we aren't admin but already logged on, go to the user page instead. |
Formats disponibles : Unified diff
Udpate to 7.33