Why do users start with an ID of 2?

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
User avatar
killaziller
Registered User
Posts: 86
Joined: Thu Feb 08, 2007 3:57 pm
Location: Torrance
Contact:

Why do users start with an ID of 2?

Post by killaziller »

Just something I've noticed is that the first user, myself, the admin, has an id of 2 rather than 1. Is there any reason for this choice? Would there be any consequences by setting a user to have an id of 1?
ZeroZaku - The phpBB playground of a highschool web designer with a suspicious attraction. It's like catharsis.
User avatar
HGN
Former Team Member
Posts: 4706
Joined: Wed Dec 03, 2008 1:53 pm
Location: The Netherlands
Name: Alfred
Contact:

Re: Why do users start with an ID of 2?

Post by HGN »

Yes, user 1 is the user anonymous. Guests viewing the forum are given permissions through that user. You should not remove the user anonymous.
User avatar
Cpt. Blackbeard
Registered User
Posts: 443
Joined: Sat Oct 31, 2009 4:39 am
Location: USA
Contact:

Re: Why do users start with an ID of 2?

Post by Cpt. Blackbeard »

And the next 50 users are bots so your second user will be user 53, unless you add more bots first.
User avatar
Seibertron
Registered User
Posts: 57
Joined: Tue Oct 01, 2002 7:54 pm
Location: Chicago, IL
Contact:

Re: Why do users start with an ID of 2?

Post by Seibertron »

Please note that you do any of my suggestions below at your own risk. I'd recommend doing this in a test environment first before doing this to a live site.

I have a phpBB forum that I've been running since 2002. I use the users table as the primary users table throughout my entire website and non-phpbb sections of the site. When I upgraded to phpBB3 back when it first came out, I was irked to find out that my user account's ID had changed from 1 to whatever phpBB changed it too. Had I left it, I would've had to gone through all of the other tables on my website and change my user ID from 1 to the new number ... far more work than figuring out how to modify phpBB so that it didn't change my user ID or any of the other existing users on my site.

Before you do an install or upgrade of phpBB3, just change the user id for ANONYMOUS in ./includes/constants.php. This should be near the top, around lines 30 to 35.

Code: Select all

define('ANONYMOUS', 1);
You can change "1" to whatever number you'd like.

I don't think you need to change the phpbb_users table when doing an install or upgrade because I think the install/upgrade script refers to constants.php to get the ANONYMOUS user id.
Seibertron.com
http://www.seibertron.com
The Ultimate Transformers Fansite
Kavi
Registered User
Posts: 1
Joined: Thu Jun 30, 2011 8:05 pm

Re: Why do users start with an ID of 2?

Post by Kavi »

Before you do an install or upgrade of phpBB3, just change the user id for ANONYMOUS in ./includes/constants.php. This should be near the top, around lines 30 to 35.

Code: Select all
define('ANONYMOUS', 1);


You can change "1" to whatever number you'd like.
I changed to "0", "30", and to "10000", but there was no effect. May be I have to change something else?
User avatar
Seibertron
Registered User
Posts: 57
Joined: Tue Oct 01, 2002 7:54 pm
Location: Chicago, IL
Contact:

Re: Why do users start with an ID of 2?

Post by Seibertron »

It's been a few years since I made this modification. I believe you have to manually change the IDs in the database as well? Can't remember what I did because I made the changes on an already existing phpBB, not a new install.
Seibertron.com
http://www.seibertron.com
The Ultimate Transformers Fansite
User avatar
Lumpy Burgertushie
Registered User
Posts: 68314
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Why do users start with an ID of 2?

Post by Lumpy Burgertushie »

Kavi wrote:
Before you do an install or upgrade of phpBB3, just change the user id for ANONYMOUS in ./includes/constants.php. This should be near the top, around lines 30 to 35.

Code: Select all
define('ANONYMOUS', 1);


You can change "1" to whatever number you'd like.
I changed to "0", "30", and to "10000", but there was no effect. May be I have to change something else?
unless you have a situation like his, then why in the world do you care what your user number is?

the only time you or anyone else will ever see it is if they hover the mouse over the username . it will then look like this:
http://www.phpbb.com/community/memberli ... &u=1324963

the u= part is your user id on this board.


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
User avatar
Seibertron
Registered User
Posts: 57
Joined: Tue Oct 01, 2002 7:54 pm
Location: Chicago, IL
Contact:

Re: Why do users start with an ID of 2?

Post by Seibertron »

For a site like mine that has tons of custom programming where our user ids are used in other custom database tables, I had to have my user id remain as 1 so that I didn't need to update it elsewhere throughout the site. The solution might not make sense to others, but on a custom site it may be a necessity.
Seibertron.com
http://www.seibertron.com
The Ultimate Transformers Fansite
User avatar
Lumpy Burgertushie
Registered User
Posts: 68314
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Why do users start with an ID of 2?

Post by Lumpy Burgertushie »

Seibertron wrote:For a site like mine that has tons of custom programming where our user ids are used in other custom database tables, I had to have my user id remain as 1 so that I didn't need to update it elsewhere throughout the site. The solution might not make sense to others, but on a custom site it may be a necessity.
I agree, in your situation it makes sense. That why I asked the OP what I did.

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
Locked

Return to “[3.0.x] Support Forum”