Is it possible to change the uid of anonymous user?

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Get Involved
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
RadarNyan
Registered User
Posts: 3
Joined: Thu Nov 22, 2012 5:24 pm

Is it possible to change the uid of anonymous user?

Post by RadarNyan » Tue Nov 27, 2012 11:02 pm

Hi guys, I'm planning to port my board to phpBB.
Since there isn't a solution for me, I have to do this by myself.

As I said in the title, I want to change the uid of anonymous user (which is 1 by default)
And I wants to use 1 for admin user (which is 2 by default)

The reason I want to do this is I have to keep the user id the same as the old board, this is really important to me. (to do this, I have to remove all bots user, they just take too many uids and useless for me)

Unfortunately, I'm not good at SQL (In fact I just started learning these days)
I've tried to run these SQL (DO NOT TRY THESE! THESE WILL BROKE YOUR BOARD)

Code: Select all

UPDATE  `phpbb`.`phpbb_users` SET `user_id` = '0' WHERE `phpbb_users`.`user_id` = 1;
UPDATE  `phpbb`.`phpbb_user_group` SET `user_id` = '0' WHERE  `phpbb_user_group`.`user_id` = 1;

UPDATE  `phpbb`.`phpbb_users` SET `user_id` = '1' WHERE `phpbb_users`.`user_id` = 2;
UPDATE  `phpbb`.`phpbb_user_group` SET `user_id` = '1' WHERE  `phpbb_user_group`.`user_id` = 2;
UPDATE  `phpbb`.`phpbb_posts` SET `poster_id` = '1' WHERE `phpbb_posts`.`poster_id` = 2;
UPDATE  `phpbb`.`phpbb_zebra` SET  `user_id` =  '1' WHERE `phpbb_zebra`.`user_id` = 2;
UPDATE  `phpbb`.`phpbb_zebra` SET  `user_id` =  '1' WHERE `phpbb_zebra`.`zebra_id` =2;
UPDATE  `phpbb`.`phpbb_topics` SET  `topic_poster` =  '1' WHERE  `phpbb_topics`.`topic_poster` =2;
UPDATE  `phpbb`.`phpbb_topics_posted` SET  `user_id` =  '1' WHERE  `phpbb_topics_posted`.`user_id` =2;
UPDATE  `phpbb`.`phpbb_topics_track` SET  `user_id` =  '1' WHERE  `phpbb_topics_track`.`user_id` =2;
UPDATE  `phpbb`.`phpbb_forums` SET  `forum_last_poster_id` =  '1' WHERE  `phpbb_forums`.`forum_last_poster_id` =2;
UPDATE  `phpbb`.`phpbb_forums_track` SET  `user_id` =  '1' WHERE  `phpbb_forums_track`.`user_id` =2;
UPDATE  `phpbb`.`phpbb_acl_users` SET  `user_id` =  '1' WHERE  `phpbb_acl_users`.`user_id` =2;
(`phpbb` is my database name.)

And the problem is, my board consider me (admin user) as anonymous user (but sure with my avatar, that's wired :S), and I have no rights to access ACP, so I had to reverse them.

:( I've tried to find all the table about user_id, I've really no idea what more should I do.

Could you give me some help please?

——————————————————

to HGN and stevemaury

Since I'm porting from an old forum, if I don't keep the uid the same, the will be a number of values need to be changed.

to Oleg and Oyabun1

Thanks, I'll check it out right now.
By the way, why should I use a positive number?
If I could change SQL to remove the UNSIGNED for user_id, could I use '-1' for anonymous user that I can keep it the same as before. Well, if not I just port all my old user data here then put anonymous users and bots after them.
Last edited by RadarNyan on Wed Nov 28, 2012 12:38 pm, edited 1 time in total.

User avatar
HGN
Former Team Member
Posts: 4706
Joined: Wed Dec 03, 2008 1:53 pm
Location: The Netherlands
Name: Alfred
Contact:

Re: Is it possible to change the uid of anonymous user?

Post by HGN » Tue Nov 27, 2012 11:07 pm

The best advice we are used to give for these type of questions is: Don't do it, since it is not worth the trouble.

Why are user id's so important?

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 50499
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Is it possible to change the uid of anonymous user?

Post by stevemaury » Tue Nov 27, 2012 11:08 pm

No one will know or care what someone's uid is.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)

Oleg
Former Team Member
Posts: 1221
Joined: Sat Jan 30, 2010 4:42 pm
Location: NYC
Contact:

Re: Is it possible to change the uid of anonymous user?

Post by Oleg » Tue Nov 27, 2012 11:11 pm

0 is a bad choice for a user id. Pick a positive number.

You also will need to change the value of ANONYMOUS constant to your chosen anonymous id.
Participate in phpBB development: Get involved | Issue tracker | Report a bug | Development board | [url=irc://chat.freenode.net/phpbb-dev]Development IRC chat[/url]
My stuff: mindlinkgame.com

User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: Is it possible to change the uid of anonymous user?

Post by Oyabun1 » Wed Nov 28, 2012 12:13 am

Oleg wrote:You also will need to change the value of ANONYMOUS constant to your chosen anonymous id.
Just to add a bit more detail:

Open includes/constants.php

Find

Code: Select all

define('ANONYMOUS', 1);
Change 1 to the userid you set for Anonymous.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests

RadarNyan
Registered User
Posts: 3
Joined: Thu Nov 22, 2012 5:24 pm

Re: Is it possible to change the uid of anonymous user?

Post by RadarNyan » Wed Nov 28, 2012 1:12 pm

I've made reply on the top,check my edit please.

I just made this reply to ask how I can mark this post as "[Resolved]"?
(and also for the question I added at top :P)

Locked

Return to “[3.0.x] Support Forum”