Is there a straightforward way of changing a user's ID globally?
(I could go for editing the PHP file to make it so that all admins can assign new admins, or so that only the new primary admin can assign new admins; but then their functionality would break at the next software update...)
Thanks!
You don't need to change the users ID. You need to change the 'id' value of the mdl_user_admins table. Say you current primary admin user has an ID of '12' in the mdl_user table. If you have a look at the mdl_user_admins table, you'll find a record where the 'userid' field has that '12' value. Incidentally it'll have the lowest value for the 'id' field (always in the mdl_user_admins table).
So all you need to set the primary admin is setting the user you want the lowest 'id' value in that field. Say the new primary admin is a user whose user id is '345'. You'll need to:
set the old primary admin a higher id value in the mdl_user_admins table, with something like:
UPDATE mdl_user_admins SET id='high-value-here' WHERE userid='12';
set the new primary admin the lowest id value in the mdl_user_admins table, with something like:
UPDATE mdl_user_admins SET id='lowest-value-here' WHERE userid='345';
Saludos. Iñaki.