[Function] set_level()

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
afterlife_69
I've Been Banned!
Posts: 630
Joined: Tue Nov 30, 2004 10:35 am

[Function] set_level()

Post by afterlife_69 » Wed Jun 29, 2005 5:17 am

Code: Select all

function set_level($level, $user_id)
{
	global $db, $sql;
	$sql = "UPDATE ". USERS_TABLE ." SET user_level = '" . $level . "' WHERE user_id = '" . $user_id . "'";
		if( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't update user level", "Database Error", __LINE__, __FILE__, $sql);
		}
	return;
}
Usage

Code: Select all

set_level($Level, $User_ID);
  • Levels avalible:
    - ADMIN
    - MOD
    - USER
This will allow you to change somebody's level.
Last edited by afterlife_69 on Sat Sep 17, 2005 5:06 pm, edited 3 times in total.

DKing
Registered User
Posts: 751
Joined: Sat Jul 03, 2004 8:38 pm

Post by DKing » Wed Jun 29, 2005 12:05 pm

So you're not asking for help? You're giving teh function out for public use? Cool! This is helpful!

EDIT: What do you put in the $Level part?
-DKing
Latest phpBB Version: 2.0.21
Search For a MOD: MOD Search

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3466
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Post by bonelifer » Wed Jun 29, 2005 1:19 pm

Admin = 1
Moderator = 2
User = 0

First, I'd assume it's one of those numeric values. It of course doesn't explain what happens when you use that piece of code to set someone to Moderator (2). What will they then be moderator of?

What would be nice is to add this to the Profile Edit page in the User Managment section of the ACP. Also if you choose Moderator (2) then it should display a popup with all the forums and check marks by each so that you could choose what forums they moderate. Of course it would be a great idea to have a edit profile link shown to Admins when they view a users profile via the memberlist or viewtopic. Seems like a cool mod. Hope someone takes it up.
Knowledge Base | phpBB Board Rules | Search Customisation Database
Image
Please don't contact me via PM or email for phpBB support .

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3466
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Post by bonelifer » Wed Jun 29, 2005 1:20 pm

edited to remove dupe post.
Knowledge Base | phpBB Board Rules | Search Customisation Database
Image
Please don't contact me via PM or email for phpBB support .

wGEric
Former Team Member
Posts: 8805
Joined: Sun Oct 13, 2002 3:01 am
Location: Friday
Name: Eric Faerber
Contact:

Post by wGEric » Wed Jun 29, 2005 4:42 pm

Eric

afterlife_69
I've Been Banned!
Posts: 630
Joined: Tue Nov 30, 2004 10:35 am

Post by afterlife_69 » Wed Jun 29, 2005 5:07 pm

Thanks wGEric, btw - typo

This function lets you set the uesr level of any user.

Post Reply

Return to “[2.0.x] MOD Writers Discussion”