PDA

View Full Version : PM upon usergroup change And PM with forum password when changed...


Chris M
12-21-2002, 06:32 AM
Right...

I've made a script that the user takes before he can access any forums...

It sorts them into a different usergroup depending on their answer;)

I am using Afterburner's password hack, as well as forum permissions for custom forums...

What I need is that when they are updated into that usergroup, they are sent the password to the custom forum that they can see...

Also - As an addon to this, I need the new password to be sent to the user's in that usergroup that can see that forum every time their Leader changes the password (the password changes every month)

Can someone help me do this, or give me the code to do it?:)

Satan

Xenon
12-21-2002, 07:27 AM
well, the first one is easy, you just have to insert a new row into the privatemessage table, you should be able to do so..

the scond one should be as easy to you need a while construct:

$users=$DB_site->query("SELECT userid FROM user WHERE usergroupid=XXX");
while($user=$DB_site->fetch_array($users)) {
$DB_site->query("INSERT INTO privatemessage.......");
}

Chris M
12-21-2002, 08:24 AM
A new row?

Oh...You mean field?

There are 4 different passwords though...Can it be done?:)

Satan

Xenon
12-21-2002, 08:38 AM
no i mean row :)

just use an insert into query :)

Chris M
12-21-2002, 01:42 PM
How would that work?

The password is stored in the forum table, and there are 4 forums for 4 different usergroups which will have 4 different passwords:confused:

Satan

Xenon
12-21-2002, 01:57 PM
$pw=$DB_site->query("SELECT password FROM forum WHERE forumid=YY");
$users=$DB_site->query("SELECT userid FROM user WHERE usergroupid=XXX");
while($user=$DB_site->fetch_array($users)) {
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,folde rid,title,message,dateline) VALUES (NULL,$user[userid],$user[userid],1,0,'New password','".addslashes($pw[password])."',".time().")");
}

Chris M
12-21-2002, 02:17 PM
Ah:)

Thanks Xenon:D

Satan

Xenon
12-21-2002, 04:44 PM
:)
welcome