FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » API to programatically add moderators and group leaders ?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
API to programatically add moderators and group leaders ? [message #35430] Wed, 10 January 2007 18:19 Go to next message
syl20 is currently offline  syl20   France
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 Go to previous message
Ilia is currently offline  Ilia   Canada
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Sending pm's via the fud api
Next Topic: backup without database
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 20:16:15 GMT 2024

Total time taken to generate the page: 0.02782 seconds