- $email_changed = ($user['origine'] != 'X' && strtolower($user['email']) != strtolower(Post::v('email')));
- $from_email = $user['email'];
- if ($user['origine'] != 'X') {
- $user['nom'] = Post::v('nom');
- $user['prenom'] = (Post::v('origine') == 'ext') ? Post::v('prenom') : '';
- $user['sexe'] = (Post::v('origine') == 'ext') ? Post::v('sexe') : 0;
- $user['origine'] = Post::v('origine');
- XDB::query('UPDATE group_members
- SET prenom = {?}, nom = {?}, email = {?}, sexe = {?}, origine = {?}
- WHERE uid = {?} AND asso_id = {?}',
- $user['prenom'], $user['nom'], Post::v('email'),
- $user['sexe'], $user['origine'],
- $user['uid'], $globals->asso('id'));
- $user['email'] = Post::v('email');
- $user['email2'] = Post::v('email');
+ $email_changed = (!$user->profile() && strtolower($user->forlifeEmail()) != strtolower(Post::v('email')));
+ $from_email = $user->forlifeEmail();
+ if (!$user->profile()) {
+ XDB::query('UPDATE accounts
+ SET full_name = {?}, directory_name = {?}, display_name = {?},
+ sex = {?}, email = {?}, type = {?}
+ WHERE uid = {?}',
+ Post::t('full_name'), Post::t('directory_name'), Post::t('display_name'),
+ (Post::t('sex') == 'male') ? 'male' : 'female', Post::t('email'),
+ (Post::t('type') == 'xnet') ? 'xnet' : 'virtual', $user->id());
+ // If user is of type xnet and new password is given.
+ if (!Post::blank('pwhash') && Post::t('type') == 'xnet') {
+ XDB::query('UPDATE accounts
+ SET password = {?}
+ WHERE uid = {?}',
+ Post::t('pwhash'), $user->id());
+ }
+ } else if (!$user->perms) {
+ XDB::query('UPDATE accounts
+ SET email = {?}
+ WHERE uid = {?}',
+ Post::t('email'), $user->id());
+ }
+ if (XDB::affectedRows()) {