TinyPortal

Development => Support => Topic started by: haktanir on March 03, 2007, 04:46:37 PM

Title: Fixing a Problem with Stats
Post by: haktanir on March 03, 2007, 04:46:37 PM
Okay I had to delete a bunca of messages from a forum, but later wanted to show the messages total as the one before the deletions.

From the SMF forum, I found out that if I add:
$context['num_posts'] += 20000;
where 20000 is the number of posts I want to be added to what it currently shows, then I get the correct one.

However, when I look at the TP Stats block on the left menu, I see that the number is updated only when I got to the Stats page. On any other page, I see the old number of posts.

Could anyone help me tweak TP Stats block to show the updated one on each page?
Title: Re: Fixing a Problem with Stats
Post by: G6Cad on March 03, 2007, 05:11:13 PM
Im not sure how to do that, i think the number of posts are fetched from the DB, but you can chek the Tportalblocks.php in the sources directory and see if and what the calls for the members could be for TP
Title: Re: Fixing a Problem with Stats
Post by: akulion on March 04, 2007, 06:12:54 AM
yup theoritically u can add it as a mathematical function to the Tportalblocks.php where the stats block is defined
Title: Re: Fixing a Problem with Stats
Post by: khoking on March 04, 2007, 12:50:47 PM
hmm...cheating? :P
Title: Re: Fixing a Problem with Stats
Post by: haktanir on March 04, 2007, 01:43:39 PM
Quote from: khoking on March 04, 2007, 12:50:47 PM
hmm...cheating? :P
No because my Monthly Summary shows the correct statistics. I'm jst trying to make the forum total match that.
Title: Re: Fixing a Problem with Stats
Post by: JPDeni on March 04, 2007, 02:50:58 PM
There's two ways that you can do this.

The first way is to go into the database itself (via phpMyAdmin, or however else you access your database) and find the smf_settings table. Look for totalMessages in the "variable" column. Edit the record and add 20000 to the value in the "value" column.

The second way is to open Load.php (in your Sources directory). After


while ($row = mysql_fetch_row($request))
$modSettings[$row[0]] = $row[1];
mysql_free_result($request);


add


$modSettings['totalMessages'] += 20000;


Either way, you'll want to remove the code you added in Stats.php.
Title: Re: Fixing a Problem with Stats
Post by: haktanir on March 04, 2007, 07:05:42 PM
Thank you very much. :)

I had already tried the first method you mentioned, that does not work for me as after some period of time, the statistics go back to the old one.

But the second method has worked. :)
Title: Re: Fixing a Problem with Stats
Post by: G6Cad on March 04, 2007, 07:34:26 PM
Glad to see you sorted it out in the end :)
Please post the answer on SMF in your post there to, it can be good for them to know to if some one else wants the same thing some time :)
Title: Re: Fixing a Problem with Stats
Post by: JPDeni on March 04, 2007, 09:46:17 PM
Quoteafter some period of time, the statistics go back to the old one.
Ah. The script must recount the number of posts from time to time. Good to know.

Glad I was able to help. :)