Author |
Message |
Sylver Cheetah 53 Board Member
Joined: 17 Dec 2008
Posts: 426 Location: Milky Way
|
Posted: Wed Feb 11, 2009 9:58 am Post subject: Freeze Postcount |
|
|
Where is this MOD? I can't find it. _________________ Image link
My Forum || My Blog
phpBB2 forever! |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
|
Back to top |
|
|
Sylver Cheetah 53 Board Member
Joined: 17 Dec 2008
Posts: 426 Location: Milky Way
|
Posted: Wed Feb 11, 2009 4:22 pm Post subject: Re: Freeze Postcount |
|
|
Thanks. Very much apreciated. _________________ Image link
My Forum || My Blog
phpBB2 forever! |
|
Back to top |
|
|
Sylver Cheetah 53 Board Member
Joined: 17 Dec 2008
Posts: 426 Location: Milky Way
|
Posted: Wed Feb 11, 2009 5:21 pm Post subject: Re: Freeze Postcount |
|
|
I have just installed it, but it doesn't work. The post count is still working, even after setting "freeze post count" to "yes". For admins and for simple users. Anyone tested this MOD? I am using 2.0.23. _________________ Image link
My Forum || My Blog
phpBB2 forever! |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Wed Feb 11, 2009 5:28 pm Post subject: Re: Freeze Postcount |
|
|
What is it supposed to do? _________________ phpBBDoctor Blog |
|
Back to top |
|
|
~Cowboy~ Board Member
Joined: 08 Dec 2008
Posts: 297 Location: Chicago
|
Posted: Wed Feb 11, 2009 5:58 pm Post subject: Re: Freeze Postcount |
|
|
If I remember correctly it stops spammers post counts from going up.
So if they are spamming the board simply to get their post counts up then you can move the high post count prize out of their reach. _________________ Image link
We are not refugees we are trail blazers. |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Wed Feb 11, 2009 6:21 pm Post subject: Re: Freeze Postcount |
|
|
I took a quick look at the code and it seems straight forward. After you set someone to frozen in the admin panel, when you go back in, are they still listed as frozen? Have you checked in the database to see that the new field exists and is getting populated?
Also there are queries in the MOD that are completely not necessary. For example:
Code: | $sql = "SELECT user_posts_frozen
FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$posts_frozen = $row['user_posts_frozen']; |
Can be replaced by
Code: | $posts_frozen = $userdata['user_posts_frozen']; |
The entire users table is retrieved into the $userdata array, there is never a need to requery the users table to get a user setting for the current user.
I didn't have time to go much further than that, but as the MOD stands it can certainly be improved. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
Posted: Wed Feb 11, 2009 6:54 pm Post subject: Re: Freeze Postcount |
|
|
drathbun wrote: |
I didn't have time to go much further than that, but as the MOD stands it can certainly be improved. |
Who validated this MOD?? Probably someone who is no longer on the MOD team.
Code: |
#
#-----[ REPLACE WITH ]------------------------------------------
#
while ( $row = $db->sql_fetchrow($result) )
{
//
// Determine whether the users
// post count is frozen
// or not.
//
$sql = "SELECT user_posts_frozen
FROM " . USERS_TABLE . "
WHERE user_id = " . $row['poster_id'];
if( !($fresult = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in deleting', '', __LINE__, __FILE__, $sql);
}
$frow = $db->sql_fetchrow($fresult);
$posts_frozen = $frow['user_posts_frozen'];
//
// Only update the users post
// count if they aren't frozen!
//
if ( !$posts_frozen )
{
$count_sql[] = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts - " . $row['posts'] . "
WHERE user_id = " . $row['poster_id'];
}
}
|
This part could be changed to put user IDs into an array, then use a single SQL query at the end with an IN() clause. _________________ Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield IL • Mac 512K Blog • Mac GUI |
|
Back to top |
|
|
Sylver Cheetah 53 Board Member
Joined: 17 Dec 2008
Posts: 426 Location: Milky Way
|
Posted: Thu Feb 12, 2009 9:32 am Post subject: Re: Freeze Postcount |
|
|
Don't know how to do that, Dog Cow.
drathbun wrote: | What is it supposed to do? |
You got a new option is user's management. Freeze Post Count: Yes/ No. If you put Yes, it should not go up or down, the number of posts should stay the same.
drathbun wrote: | I took a quick look at the code and it seems straight forward. After you set someone to frozen in the admin panel, when you go back in, are they still listed as frozen? Have you checked in the database to see that the new field exists and is getting populated? |
Yes, it changes in the database from 0 to 1.
Image link
drathbun wrote: | Also there are queries in the MOD that are completely not necessary. For example:
Code: | $sql = "SELECT user_posts_frozen
FROM " . USERS_TABLE . "
WHERE user_id = $user_id";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$posts_frozen = $row['user_posts_frozen']; |
Can be replaced by
Code: | $posts_frozen = $userdata['user_posts_frozen']; |
|
I've done this changes, but still the post count is not freezing. _________________ Image link
My Forum || My Blog
phpBB2 forever! |
|
Back to top |
|
|
|