29th / personnel-v2

Personnel management system version 2 (legacy)
4 stars 7 forks source link

Sync remaining emails #542

Closed wilson29thid closed 3 years ago

wilson29thid commented 3 years ago

I realised that I forgot to enable the EmailInSessionToken vanilla plugin after deploying it, so the last few days, any new recruits did not get their email stored in the personnel members table. So auto associating won't work for them (assuming they pass BCT and eventually need to).

I'll need to sync any missing emails from #498. And we'll probably need to do this again to cover anyone who already has a forum account and is logged in, but never enlisted (e.g. lurker public members), as their logged in session wouldn't include the email in it until they logout and back in.

wilson29thid commented 3 years ago

I did it using this SQL

-- select last_name, members.email, GDN_User.Email from members -- check first
update members
left join vanilla.GDN_User
    on GDN_User.UserId = members.forum_member_id
set members.email = GDN_User.Email
where forum_member_id is not null and forum_member_id <> 0
    and members.email is null