PDA

View Full Version : sql command for adding a member to user group?


sandman1970
07-12-2004, 07:34 AM
I have a "hidden" forum (H_forum). Till now I must add
registered member to a group (H_group) - the only group
that has access to H_forum.

Now the hidden H_forum is bigger, I can not add new
member to H_group myself, I want moderators of
H_forum can add new member to H_group too.

anyway the problem is: the H_group is hidden too,
is not Joinable.

I have idea to write small php script runable only
by moderators of H_forum, the php script will
run sql command like this:

UPDATE vb3_user SET options=
newOptionWithmembergroupids = 'numberOf_H_group'
WHERE ...

Could you write me the sql command?
I have zero know-how about VB db tables structure,
i will be very appriciated with your help and time.

Andreas
07-12-2004, 08:41 AM
UPDATE user SET membergroupids = CONCAT_WS(',', membergroupids, 'x') WHERE userid=y


should do te trick. Plase note that you must replace x with the id of youre h group and y with the userid of the user you want to add. If you use a table prefix you must add it in front of user.