API to programatically add moderators and group leaders ? [message #35430] |
Wed, 10 January 2007 18:19 |
syl20
Messages: 7 Registered: January 2007
Karma: 0
|
Junior Member |
|
|
Hi,
I'm looking for an API or suggestions to add moderators and leaders via scripting.
I need to synchronize users and moderators from an external app.
Reading mysql logs when adding a moderator shows this :
DELETE FROM fud26_mod WHERE user_id=96;
INSERT INTO fud26_mod (forum_id, user_id) VALUES(3, 96);
UPDATE fud26_forum SET moderators=NULL;
UPDATE fud26_forum SET moderators='a:1:{i:96;s:32:\"display name\";}' WHERE id=3;
UPDATE fud26_users SET users_opt=users_opt & ~ 524288 WHERE users_opt>=524288 AND (users_opt & 524288) > 0;
UPDATE fud26_users SET users_opt=users_opt|524288 WHERE id IN(96) AND (users_opt & 1048576)=0;
It seems to be quite complicated. I'm wondering if there's a function to call to do that ?
Thanks,
Sylvain
|
|
|
Re: API to programatically add moderators and group leaders ? [message #35447 is a reply to message #35430] |
Fri, 12 January 2007 02:27 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
You have sets of commands here 1 to add a mod:
INSERT INTO fud26_mod (forum_id, user_id) VALUES(3, 96);
UPDATE fud26_forum SET moderators='a:1:{i:96;s:32:\"display name\";}' WHERE id=3;
UPDATE fud26_users SET users_opt=users_opt|524288 WHERE id IN(96) AND (users_opt & 1048576)=0;
and another to remove a mod
DELETE FROM fud26_mod WHERE user_id=96;
UPDATE fud26_forum SET moderators=NULL;
UPDATE fud26_users SET users_opt=users_opt & ~ 524288 WHERE users_opt>=524288 AND (users_opt & 524288) > 0;
Just wrap those two in the functions and voila...
FUDforum Core Developer
|
|
|