AllenSam
09-14-2005, 01:42 AM
I got a question about the points system...
Well, you know how when you move a post from a forum that counts posts towards user post counts to a forum that doesn't, it deducts the post from their postcount? How could I get it to deduct the points they got for the post as well?
I'm pretty sure it would go somewhere in postings.php here:
// Update Post Count if we move from a counting forum to a non counting or vice-versa..
if (($method == 'move' OR $method == 'movered') AND (($foruminfo['countposts'] AND !$destforuminfo['countposts']) OR (!$foruminfo['countposts'] AND $destforuminfo['countposts'])))
{
$posts = $DB_site->query("
SELECT userid
FROM " . TABLE_PREFIX . "post
WHERE threadid = $threadinfo[threadid] AND
userid <> 0
");
$userbyuserid = array();
while ($post = $DB_site->fetch_array($posts))
{
if (!isset($userbyuserid["$post[userid]"]))
{
$userbyuserid["$post[userid]"] = 1;
}
else
{
$userbyuserid["$post[userid]"]++;
}
}
if (!empty($userbyuserid))
{
$userbypostcount = array();
foreach ($userbyuserid AS $postuserid => $postcount)
{
$alluserids .= ",$postuserid";
$userbypostcount["$postcount"] .= ",$postuserid";
}
foreach($userbypostcount AS $postcount => $userids)
{
$casesql .= " WHEN userid IN (0$userids) THEN $postcount";
}
$operator = iif($destforuminfo['countposts'], '+', '-');
$DB_site->query("
UPDATE " . TABLE_PREFIX . "user
SET posts = posts $operator
CASE
$casesql
ELSE 0
END
WHERE userid IN (0$alluserids)
");
}
}
But, I don't know much PHP so I'm not sure what to change or add...
If anyone can help out with this, I would be grateful...thanks.
Well, you know how when you move a post from a forum that counts posts towards user post counts to a forum that doesn't, it deducts the post from their postcount? How could I get it to deduct the points they got for the post as well?
I'm pretty sure it would go somewhere in postings.php here:
// Update Post Count if we move from a counting forum to a non counting or vice-versa..
if (($method == 'move' OR $method == 'movered') AND (($foruminfo['countposts'] AND !$destforuminfo['countposts']) OR (!$foruminfo['countposts'] AND $destforuminfo['countposts'])))
{
$posts = $DB_site->query("
SELECT userid
FROM " . TABLE_PREFIX . "post
WHERE threadid = $threadinfo[threadid] AND
userid <> 0
");
$userbyuserid = array();
while ($post = $DB_site->fetch_array($posts))
{
if (!isset($userbyuserid["$post[userid]"]))
{
$userbyuserid["$post[userid]"] = 1;
}
else
{
$userbyuserid["$post[userid]"]++;
}
}
if (!empty($userbyuserid))
{
$userbypostcount = array();
foreach ($userbyuserid AS $postuserid => $postcount)
{
$alluserids .= ",$postuserid";
$userbypostcount["$postcount"] .= ",$postuserid";
}
foreach($userbypostcount AS $postcount => $userids)
{
$casesql .= " WHEN userid IN (0$userids) THEN $postcount";
}
$operator = iif($destforuminfo['countposts'], '+', '-');
$DB_site->query("
UPDATE " . TABLE_PREFIX . "user
SET posts = posts $operator
CASE
$casesql
ELSE 0
END
WHERE userid IN (0$alluserids)
");
}
}
But, I don't know much PHP so I'm not sure what to change or add...
If anyone can help out with this, I would be grateful...thanks.