PDA

View Full Version : Change User Group By post Count


wolfe
09-04-2002, 08:32 PM
is there a hack out of a bit of template editing or can someone make it please :D

what i mean is like you get 10 posts you move to another group automaticly :D

g-force2k2
09-04-2002, 09:23 PM
you could just manually add it in to the newthread and newreply.php files... for instance...

if($bbuserinfo[posts] > 10) {
$DB_site->query("UPDATE user SET usergroupid='{theusergroupidhere}' WHERE userid='$bbuserinfo[userid]'");
}

if you're looking for something more sophistic i can help you... but i personally would just suggest using the ranking system instead :p regards...

g-force2k2

wolfe
09-04-2002, 09:43 PM
thanx d00d but where do i put it

wolfe
09-04-2002, 09:59 PM
not working :(

wolfe
09-04-2002, 10:00 PM
i put it here under

eval("standarderror(\"".gettemplate("error_toolong")."\");");
}

Logician
09-04-2002, 10:12 PM
Put it after


$DB_site->query("UPDATE user SET
".iif ($foruminfo[countposts],"posts=posts+1,","")."
$dotitle"."lastpost='".time()."' WHERE userid='$bbuserinfo[userid]'");


And I suggest using this code instead:

if($bbuserinfo[posts] == 10 AND $bbuserinfo[usergroupid]==2) {
$DB_site->query("UPDATE user SET usergroupid='{theusergroupidhere}' WHERE userid='$bbuserinfo[userid]'");
}


Otherwise all your users with more than 10 posts including Admins, Mods, S.Mods etc. will end up in your new usergroup hehe

You can use $bbuserinfo[posts] > 10 instead of $bbuserinfo[posts] == 10 (as g-force suggested) and it will help you to automatically convert users with more than 10 posts whenever they post, but if you use $bbuserinfo[posts] == 10, you'll save 1 query in every new reply and thread. Of course then you need to manually update members more than 10 posts and the hack will apply to new users (members with less than 10 posts) only.. Your call..

wolfe
09-04-2002, 10:33 PM
still not working :(

Logician
09-04-2002, 10:43 PM
If you applied my code, you have to test it out under these conditions:
1- Testing user must be a "normal" member (usergroup id=2)
2- It should be tested at the moment he has "10" posts in your board. (Not more, not less)
3- The user must reply a thread or create a new thread to change his usergroup

wolfe
09-04-2002, 10:45 PM
i have not working

Logician
09-04-2002, 10:53 PM
Right before the hack code, add this:

echo "My Usergroup id is ".$bbuserinfo[usergroupid]."<br>";
echo "My Post Count is ".$bbuserinfo[posts]."<br>";


Then test it out and tell me what it will display to you after you posted..

wolfe
09-04-2002, 11:01 PM
that worked but now it shows

My Usergroup id is 10
My Post Count is 9

@ the top :(

Logician
09-04-2002, 11:15 PM
that worked but now it shows
yes it is supposed to show this, because these lines for debugging purposes only (=tracking the problems). :)

And it showed me that there is nothing wrong with the code, you werent just trying with either a correct usergroupid or post number..

You can now delete the code you added..Your hack is working ok..

wolfe
09-04-2002, 11:16 PM
:) niceone d00d you da man :D

g-force2k2
09-05-2002, 12:07 AM
nice work Logician ;) thats what i usually do to test my stuff to... if somethign isn't working i'll echo it and see whats up with my variables :) brilliant as always... regards...

btw good thing you recognized the usergroupid = 2 :p i would've felt dumb ;)

g-force2k2

wolfe
09-06-2002, 12:10 AM
now i took that out it don't work :(

Logician
09-06-2002, 06:06 AM
Originally posted by wolfe
now i took that out it don't work :(
wolfe it's impossible because these lines are absolutely irrelevant to what the hack is doing.

Try this:
Set a user's post count to 9 via PHPmyAdmin.
Login as him.
Post 4 messages.
And after each post check if the usergroup has changed.

You'll get how the hack works then. You are always missing the fact that hack will change his usergroup ONLY when user has exactly 10 posts (and he posts a new one). So if you try when he has 20 posts it will not work. If you want it otherwise you can use

if($bbuserinfo[posts] >= 10 AND $bbuserinfo[usergroupid]==2) {


line instead (as a first line).

[D]Vincent
09-06-2002, 06:22 AM
WHy would you want to do that? Why not just use the user title thing instead? That's what I did and since members wanted a Custom Title also I made a profile field for Custom Title and just added that profile field to be displayed under the user title.

Logician
09-06-2002, 09:27 AM
Originally posted by [D]Vincent
WHy would you want to do that? Why not just use the user title thing instead? That's what I did and since members wanted a Custom Title also I made a profile field for Custom Title and just added that profile field to be displayed under the user title.
I think he is not trying to assign a custom title. His goal may be to grant them other features via their new group like PM rights/access to certain forums/right to post in certain boards by access masks etc.

wolfe
09-06-2002, 11:11 AM
yeah thats it also d0d say this code here


if ($post[posts] > 1000)
{ $pips = "<img src=\"images/pip21.gif\" border=0>"; }
elseif ($post[posts] > 950)
{ $pips = "<img src=\"images/pip20.gif\" border=0>"; }
elseif ($post[posts] > 900)
{ $pips = "<img src=\"images/pip19.gif\" border=0>"; }


will the top one chage to the pip21 when on 1000 or 1001

wolfe
09-06-2002, 11:13 AM
also is there a way to make it for all member if someone is deleted in the admin CP it make them a ignore user and they are ignored to everyone else :D

wolfe
09-08-2002, 01:33 PM
right i also what it ot change usertitile when it gets 10 posts i have tried adding this


if($bbuserinfo[posts] == 10 AND $bbuserinfo[usergroupid]== 2 AND $bbuserinfo[usertitle] == Trial Member<br><img src="http://www.s2k2.com/forums/images/0stars.gif">) {
$DB_site->query("UPDATE user SET usergroupid='10' WHERE userid='$bbuserinfo[userid]'");
$DB_site->query("UPDATE user SET usertitle='1' WHERE usertitle='$bbuserinfo[usertitle]'");
}


what else do i add :D

wolfe
09-08-2002, 01:40 PM
would this work :D

wolfe
09-09-2002, 01:04 PM
i am having problems with this code

i added it and it works it moved people to another group on so many posts but there user title is not updating so i tried the second bit of code bu noe look please hey me :(


echo "Your User Group Is ".$bbuserinfo[usergroupid]."<br>";
echo "My Post Count is ".$bbuserinfo[posts]."<br>";

if($bbuserinfo[posts] == 9 AND $bbuserinfo[usergroupid]== 2) {
$DB_site->query("UPDATE user SET usergroupid='10' WHERE userid='$bbuserinfo[userid]'");
}


this one is after they have moved groups


if($bbuserinfo[posts] == 10 AND $bbuserinfo[usergroupid]== 10) {
$DB_site->query("UPDATE user SET usertitle='New Member<br><img src="http://www.s2k2.com/forums/images/1stars.gif">' WHERE usertitle='$bbuserinfo[usertitle]'");
}


but i get an error when i add it why

clubdub
10-02-2002, 02:08 AM
i know this is old, but what Logician posted didn't work for me.

This one did.
if($bbuserinfo[posts] >= 10 AND $bbuserinfo[usergroupid]==2) {
$DB_site->query("UPDATE user SET usergroupid='{theusergroupidhere}' WHERE usergroupid='2'");

Logician
10-02-2002, 07:26 AM
Originally posted by clubdub
i know this is old, but what Logician posted didn't work for me.

This one did.
if($bbuserinfo[posts] >= 10 AND $bbuserinfo[usergroupid]==2) {
$DB_site->query("UPDATE user SET usergroupid='{theusergroupidhere}' WHERE usergroupid='2'");
Well, I dont suggest using this code..

Your code is not only changing the usergroup of the poster, but updating the usergroup for ALL USERS in your database. (ones who are from usergroup 2 and post >=10). This might not be a problem to you but I want to remind you the unnecessary MYSQL server load you are creating for every post your members sent..This can especially be a problem if your post number or user number gets bigger..

The reason my code didnt work for you is probably because you didnt test it when you have exactly 10 posts. As I said in my message it will work ONLY when you are on the exact post number, not less, not much..

If you change $bbuserinfo[posts] == 10 to $bbuserinfo[posts] >= 10 in my code as I mentioned, your problem should be cured..

Learner29
10-18-2002, 05:55 PM
thank you logician ......

Learner29
10-18-2002, 06:02 PM
I highly appreciate your help

xs1
06-23-2003, 03:33 AM
its so confusing!!!! can anyone tell me wat exactly to be added and where ?

insanctus
06-23-2003, 03:55 AM
Is there any way to add an age check into this.

Say if they hit 50 posts and are 18 or over then it changes them?

The reason I ask is I have a section I want only 18 and older in and only after so many posts.

This will make my life alot easier.

allan grossman
08-29-2003, 12:12 PM
I'm gonna need something like this this weekend but would prefer to run it as a job in cron.daily

What I need to do is scan the database for users who are in usergroup 2 that have more than 249 posts and change their usergroup to usergroup xx.

Could someone hook me up, please?

midnightz
10-31-2003, 03:29 PM
Hi - I tried to install this and when the user from usergroup 2 reaches the activation post that changes them to the usergroup you wish, they get locked out?

Its quite odd?

Any help would be great

Thankies :)

Note - It did move the usergroup, but it moved them to COPPA (4) when I inputed the usergroup to be luckykittens (18) - Okay zuper weird?

Logician
11-03-2003, 09:39 AM
There are a lot of codes given in this thread and you didn't mention which of them you installed. And you'd better copy/paste the code from your own files to here instead of pointing it.

midnightz
11-03-2003, 10:26 AM
Hi Logician,

I used yours from post 6, but it moved the group to coppa (4) even though I had it pointed to 18.

I'm going to try to place iot in globals like you said in that other thread instead of in newreply and newthread.

Cheers