https://www.icyphoenix.com/viewtopic.php?f=4&t=2528
-----------------------------------
novice programmer
Wed 25 Jul, 2007 22:23

CUSTOMIZATION - Adding New Kind Of Users For Preventing Not Auth Acces
-----------------------------------
To create a new range of users (reg, mod, admins,...) we have to go to the file:

[code linenumbers=false]includes/constants.php[/code]
and there seach for:

[code linenumbers=false]
// User Levels <- Do not change the values of USER or ADMIN
define('DELETED', -1);
define('ANONYMOUS', -1);

define('USER', 0);
define('ADMIN', 1);
define('MOD', 2);
define('GLOBAL_MOD', 3);
define('JUNIOR_ADMIN', 4);
[/code]

and after that, before the next "//" with the sintax:

[code linenumbers=false]
define('[highlight]TEXT[/highlight]', [highlight]NUMBER[/highlight]);
[/code]

create a new type of user
Ex:

[code linenumbers=false]
define('[highlight]GREAT_ADMIN[/highlight]', 5)
[/code]

So we´ve changed the red coloured zones.
NOTE THAT: we´ve choosed the number 5, but you can put any number that you want in that zone. 

ANOTHER NOTE: the valve "GREAT_ADMIN" is an example, you can put what you want


=============================================================================

UTILITY: you can use this to disallow ohers admins to entry into the file 

[code linenumbers=false]adm/admin_db_utilities.php[/code]

by typying at the start of the file (easymod style):
[code sintax=php linenumbers=false]

-----------SEARCH-------------------

$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.' . $phpEx);

-----------AFTER, ADD---------------

if( $userdata['user_level'] != ADMIN && $userdata['user_id'] != 2 )
redirect($phpbb_root_path . 'errors.'.$phpbbEx.'?code=401');

[/code]

==================================================================

NOTE: You can use this in any file.


----------------------------------------------------

How to modify the rank of auths:

Enter into a db manager with editor.

GO to the table "prefix+users"
Modify the user to apply auth
In "user_level" put the number of the define command.

That´s all.


-----------------------------------
Mighty Gorgon
Thu 26 Jul, 2007 00:22

Re: Adding New Kind Of Users For Preventing Not Auth Acces
-----------------------------------
Thanks for this tutorial... I've edited your message inserting HIGHLIGHT command in code instead of COLOR BBCode which is not working in CODE tag.

Finally I would just to add that if you define a constant is because you don't want to remember all the number assigned... so, for example if you put:
[code]$user_level == ADMIN[/code]

is perfectly identical to
[code]$user_level == 1[/code]

Because you set ADMIN = 1 as a constant.

Finally if you define new users type, you need then to specify elsewhere how a user can have a different level... otherwise you need to change each user level directly into phpMyAdmin.


-----------------------------------
novice programmer
Thu 26 Jul, 2007 22:09

Re: Adding New Kind Of Users For Preventing Not Auth Acces
-----------------------------------
[quote user="novice programmer" post="17981"]
How to modify the rank of auths:

Enter into a db manager with editor.

GO to the table "prefix+users"
Modify the user to apply auth
In "user_level" put the number of the define command.

That´s all.
[/quote]

That explain how to change, as you said with:

[quote user="Mighty Gorgon" post="17996"]
Finally if you define new users type, you need then to specify elsewhere how a user can have a different level... otherwise you need to change each user level directly into phpMyAdmin.
[/quote]


-----------------------------------
novice programmer
Fri 27 Jul, 2007 21:27

Re: Adding New Kind Of Users For Preventing Not Auth Acces
-----------------------------------
Thanks for explains & changes.

There is another tho things:

If you want to disallow all users to entry the file put (easymod style):

[code linenumbers=false]

-----------[SEARCH]---------------------

$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_selects.' . $phpEx);

------------[AFTER, ADD]------------------

redirect('/errors.'.$phpEx.'?code=401');

[/code]

WARING: THIS WILL DISALLOW YOURSELF TO ENTER THAT FILE!!!


-----------------------------------
novice programmer
Fri 27 Jul, 2007 21:47

Re: Adding New Kind Of Users For Preventing Not Auth Acces
-----------------------------------
for allow only the first user entry (easymod style):

[code linenumbers=false]

---------[SEARCH]-------------------------------

require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include_once($phpbb_root_path . 'includes/functions_selects.' . $phpEx);

--------[AFTER, ADD]---------------------------

if ( $userdata['user_id'] != 2)
redirect('/errors.'.$phpEx.'?code=401');

[/code]

That´s all.


