MyBB Community Forums

Full Version: [Request]Auto Usergroup Change
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
IMPAQ Wrote:Would that move moderators and/or administrators from their respective usergroup?
No, it does not as you choose the old and the new usergroup. If you choose the group Administrators they will be moved into the new usergroup but that's nonsense.
Augustino Wrote:But currently is this possible in mybb 1.1 without modifications?
It is possible in MyBB 1.1 but you have to modify one file (global.php).
Oh, derr. Yeah, makes sense.
Michael83 Wrote:Insert the code at the end before the ?>.

You have to edit the Usergroup-IDs. You can see them in the usergroups cache or in your database via phpMyAdmin.

Example: If the ID of the group "Registered" is 1 and the ID of the other group is 8 then the code should look like this:
// Usergroup-ID Group 1 (old group)
$gid1 = "1";

// Usergroup-ID Group 2 (new group)
$gid2 = "8";

Please Michael83 Help me To Do This...

Thank you in Advence !
Do what? The only thing you have to change are the usergroup IDs.
Michael83 Wrote:Do what? The only thing you have to change are the usergroup IDs.
Oups.. sorry Michael83 (Wrong Quote)

Quote:When you use this method, you have to run the following query via phpmyadmin to update all users that already have more than x posts:

UPDATE mybb_users SET usergroup = 'x', displaygroup = 'x' WHERE postnum >= 'y' AND usergroup = 'z'

x = new goup id
y = minimal post number
z = old group id

I Maded What you told But User Groups didn't Changed .. ???

Anny Ideea ???
Please Help me With This... Thanx.Rolleyes
Worked perfectly for me. Thank you.
Mogadishu Wrote:I Maded What you told But User Groups didn't Changed .. ???
Did you replace x,y and z with the correct IDs?
yup..But didn't Worked. (anyway Filled - ive Edited all Users Who have 20 Posts.)

if User make 20 Posts Now Is Automatic Moved to The Next Group.

Thank You For This Greate Code.
Michael83 Wrote:A nicer solution (far less queries): Insert into global.php
## Update Usergroup ##
// Usergroup-ID Group 1 (old group)
$gid1 = "2";

// Usergroup-ID Group 2 (new group)
$gid2 = "4";

// Minimal number of posts
$minposts = "5";

// Update user
if ($mybb->user['postnum'] == $minposts)
{
// Update usergroup
$update_group = $db->query("UPDATE ".TABLE_PREFIX."users SET usergroup = '".$gid2."', displaygroup = '".$gid2."' WHERE uid = '".$mybb->user['uid']."' AND usergroup = '".$gid1."'");
}
## Update Usergroup ##
When you use this method, you have to run the following query via phpmyadmin to update all users that already have more than x posts:
UPDATE mybb_users SET usergroup = 'x', displaygroup = 'x' WHERE postnum >= 'y' AND usergroup = 'z'
x = new goup id
y = minimal post number
z = old group id

What happened if you want another usergroup to change to another usergroup..

Let say we used this script to change Usergroup1 to Usergroup2. Now I want to change Usergroup2 to Usergroup3, is that still possible? If so how should we modify the global.php. Any samples Smile

Thanks!

Zac
you can have simply another query, with other variables

e.g

 $gid1a = "4";


$gid2a = "5";

// Minimal number of posts
$minpostsa = "10";

// Update user
if ($mybb->user['postnum'] == $minpostsa)
{
// Update usergroup
$update_group2 = $db->query("UPDATE ".TABLE_PREFIX."users SET usergroup = '".$gid2a."', displaygroup = '".$gid2a."' WHERE uid = '".$mybb->user['uid']."' AND usergroup = '".$gid1a."'");
Pages: 1 2 3 4 5