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

Home » FUDforum Development » Plugins and Code Hacks » API hooks into post moderation?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: API hooks into post moderation? [message #160685 is a reply to message #160675] Tue, 13 October 2009 01:26 Go to previous messageGo to previous message
LADave is currently offline  LADave   United States
Messages: 19
Registered: July 2009
Location: Los Angeles
Karma:
Junior Member
Here's my first shot at auto-moderation based on previous post count. This should work great in my forum since I trust NNTP posts from people who have a proven track record but I want to moderate newly created users or users with less than a certain amount of posts (trying 6 posts to start with).

Comments/improvements appreciated.

-Dave

#!/usr/local/bin/php -q
<?php
include_once 'GLOBALS.php';
include_once 'fudapi.inc.php';
fud_use('db.inc');
fud_use('imsg_edt.inc');
fud_use('rev_fmt.inc');
fud_use('cookies.inc');
fud_use('users.inc');
fud_use('th.inc');
fud_use('th_adm.inc');
fud_use('fileio.inc');
fud_use('isearch.inc');
fud_use('iemail.inc');

$i = 0;
$postsToAutoApprove = 6;
$maxToApprove = 100;
$c = q("SELECT id FROM ".$GLOBALS['DBHOST_TBL_PREFIX']."msg WHERE apr=0");
while ($r = db_rowobj($c)) {
      $msg = fud_fetch_msg($r->id);
      $user = fud_fetch_user($msg->poster_id);
      if ($user->posted_msg_count >= $postsToAutoApprove) 
      {
		echo "Approved message ID# ". $r->id ." (" . $user->login . "): " . $msg->subject . "\n";
		fud_msg_edit::approve($r->id);
		$i++;
		if ($i>$maxToApprove)
			break;
	  }
}
if ($i>0)
	echo $i." messages approved.\n";
?>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: "News"
Next Topic: NNTP improvements
Goto Forum:
  

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

Current Time: Sun Nov 24 17:52:56 GMT 2024

Total time taken to generate the page: 0.04018 seconds