News:

Wondering if this will always be free?  See why free is better.

Main Menu

Mod: "Recount member posts"

Started by Adraeus, November 22, 2005, 09:54:09 AM

Previous topic - Next topic

Adraeus

Would someone please convert the following code, written by [Unknown], into a Forum Maintenance (General Maintenance) mod? Thank you.


<?php

include_once('SSI.php');

$result db_query("
SELECT ID_MEMBER, COUNT(ID_MSG) AS posts
FROM 
{$db_prefix}messages
GROUP BY ID_MEMBER"
__FILE____LINE__);

while (
$row mysql_fetch_assoc($result))
{
db_query("
UPDATE 
{$db_prefix}members
SET posts = " 
. (int) $row['posts'] . "
WHERE ID_MEMBER = 
$row[ID_MEMBER]
LIMIT 1"
__FILE____LINE__);
}

mysql_free_result($result);

?>



Source

MaximKat

up! :)
but don't forget that posts in some boards shouldn't be counted
Answers: $1, Short: $5, Correct: $25, dumb looks are still free.

MaximKat

<?php

include_once('SSI.php');

$result db_query("
SELECT ID_MEMBER, COUNT(ID_MSG) AS posts
FROM 
{$db_prefix}messages JOIN {$db_prefix}boards ON {$db_prefix}messages.ID_BOARD={$db_prefix}boards.ID_BOARD
WHERE countPosts=0
GROUP BY ID_MEMBER"
__FILE____LINE__);

while (
$row mysql_fetch_assoc($result))
{
db_query("
UPDATE 
{$db_prefix}members
SET posts = " 
. (int) $row['posts'] . "
WHERE ID_MEMBER = 
$row[ID_MEMBER]
LIMIT 1"
__FILE____LINE__);
}
mysql_free_result($result);

echo 
"Done...";

?>


here it is
just convert it into the mod, plz
Answers: $1, Short: $5, Correct: $25, dumb looks are still free.

MaximKat

Ok... I created a mod myself  ;D
Just test it (i'm using 1.1)
Posts are recounted when you click "Recount all forum totals and statistics" in Maintainance section
Oh, it lives here http://mods.simplemachines.org/index.php?mod=561
Not approved yet, though
Answers: $1, Short: $5, Correct: $25, dumb looks are still free.

Advertisement: