Topic: Script to remove users with signatures but no posts from PunBB 1.3.x
Script to remove users with signatures but no posts from PunBB 1.3.x
Author: Slavok
<?php
define('FORUM_IGNORE_REQUEST_URI', 1);
define('FORUM_ROOT', '/home/.../public_html/.../');
define('NUM_DAYS', 7);
include FORUM_ROOT.'include/essentials.php';
$select_query = array(
'SELECT' => 'id',
'FROM' => 'users',
'WHERE' => '( num_posts = 0 ) AND (registered < ( NOW() - '.(NUM_DAYS * 86400).' )) AND (( signature IS NOT NULL ) OR ( url IS NOT NULL ))'
);
$query_result = $forum_db->query_build($select_query) or error(__FILE__, __LINE__);
$num_users = 0;
while ($cur_user = $forum_db->fetch_assoc($query_result))
{
delete_user($cur_user['id'], false);
$num_users++;
}
echo $num_users.' was removed from DB'."\n";
$forum_db->close();
?>
Thanks a lot to Slavok for coding this.