HELLO ,
how i update posts count for A specific user ?
i found this code on
admin/misc.php , how i can used it in plugin ?!
Or if there any Other solutions easier , To perform this jop !
PHP Code:
$totalposts = $db->query_first("
SELECT COUNT(*) AS posts
FROM " . TABLE_PREFIX . "post AS post
INNER JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)
WHERE post.userid = $user[userid]
AND thread.forumid IN (0$gotforums)
AND thread.visible = 1
AND post.visible = 1
");
$userdm =& datamanager_init('User', $vbulletin, ERRTYPE_CP);
$userdm->set_existing($user);
$userdm->set('posts', $totalposts['posts']);
$userdm->set_ladder_usertitle($totalposts['posts']);
$userdm->save();
unset($userdm);
Note :
i used this plug on [
newpost_process] Hook
to un-visible posts if user posts Less than 5 , but when i Accept users waiting posts , count of posts not update .. so i want put Auto-update code of posts count when user put new-post
PHP Code:
if ( $vbulletin->userinfo['posts'] <= 5 )
{
$dataman->set('visible', 0);
}