MyBB Community Forums

Full Version: UID2 -> UID1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Currently, I am UID2.
What is the query I run to give myself UID1?
--

Do I delete the member using UID1 first?
Will any statistics change from my profile(online time, posts, reputation)?
What will happen to UID2?
Would you prefer to remove UID1 or switch UID1 + 2 around?
I want to use UID1 for my profile.
I'm not great with SQL queries but these will work.
UPDATE  `mybb`.`mybb_users` SET  `uid` =  null WHERE  `mybb_users`.`uid` =1;
UPDATE  `mybb`.`mybb_users` SET  `uid` =  '1' WHERE  `mybb_users`.`uid` =2;
UPDATE  `mybb`.`mybb_users` SET  `uid` =  '2' WHERE  `mybb_users`.`uid` =0;
There are far more tables you'll have to do this in, there's lots of other tables where the UID is stored. Obviously you'd have to do something to the current UID 1 first, you can't have two rows with the same UID.
So I can delete the member and posts using uid1, then I can run the queries above?
Merge user 2 into user 1 using admincp. Just make sure to change the login for user 1 so you know it. After the merge also alter your config.php so uid 1 is super admin.
What would be even better, is if I could just switch uid's without deleting anyone. Also possible?
I should of asked that first.
Run a query to change the original UID to a higher one that isn't taken yet, then set yours to one. ie. set user 1's UID to UID 465 then set yours from 2 to 1. I don't really know the proper SQL query but one that affects all tables/rows will work.

---

.. apparently there is no SQL query that affects all databases, so I came up with this:
update mybb_adminlog set uid = 7 where uid = 1;
update mybb_adminoptions set uid = 7 where uid = 1;
update mybb_adminsessions set uid = 7 where uid = 1;
update mybb_adminviews set uid = 7 where uid = 1;
update mybb_announcements set uid = 7 where uid = 1;
update mybb_attachments set uid = 7 where uid = 1;
update mybb_awaitingactivation set uid = 7 where uid = 1;
update mybb_banned set uid = 7 where uid = 1;
update mybb_delayedmoderation set uid = 7 where uid = 1;
update mybb_events set uid = 7 where uid = 1;
update mybb_forumsread set uid = 7 where uid = 1;
update mybb_forumsubscriptions set uid = 7 where uid = 1;
update mybb_groupleaders set uid = 7 where uid = 1;
update mybb_joinrequests set uid = 7 where uid = 1;
update mybb_massemails set uid = 7 where uid = 1;
update mybb_moderatorlog set uid = 7 where uid = 1;
update mybb_pollvotes set uid = 7 where uid = 1;
update mybb_posts set uid = 7 where uid = 1;
update mybb_privatemessages set uid = 7 where uid = 1;
update mybb_promotionlogs set uid = 7 where uid = 1;
update mybb_reportedposts set uid = 7 where uid = 1;
update mybb_reputation set uid = 7 where uid = 1;
update mybb_searchlog set uid = 7 where uid = 1;
update mybb_sessions set uid = 7 where uid = 1;
update mybb_threadratings set uid = 7 where uid = 1;
update mybb_threads set uid = 7 where uid = 1;
update mybb_threadsread set uid = 7 where uid = 1;
update mybb_threadsubscriptions set uid = 7 where uid = 1;
update mybb_users set uid = 7 where uid = 1;
update mybb_warnings set uid = 7 where uid = 1;

Run once, changing 7 to something not used for the original 1st user, then run a second time changing the 7 to 1 and the 1 to 2. DOn't forget the prefix change.