Warning: The author of this contribution does not provide support for it anymore.

NV usertopics

Bug: changing post author is not handled - NV usertopics

Bug: changing post author is not handled

by AmigoJack » Wed Oct 16, 2013 8:02 pm

When changing the post author this MOD won't handle the case when the post is the first of a topic and counted user topics should change aswell.

To fix this open /includes/mcp/mcp_post.php and find:

Code: Select all

        $sql 'UPDATE ' USERS_TABLE '
            SET user_posts = user_posts - 1
            WHERE user_id = ' 
$post_info['user_id'] .'
            AND user_posts > 0'
;
        
$db->sql_query($sql);

        
$sql 'UPDATE ' USERS_TABLE '
            SET user_posts = user_posts + 1
            WHERE user_id = ' 
$userdata['user_id'];
        
$db->sql_query($sql);  
After, add:

Code: Select all

        /*** 2013-10-15 BEGIN AmigoJack
            Also consider users topic count ***/
        
if( $post_info['topic_first_post_id']== $post_id ) {
            
$sql'UPDATE 'USERS_TABLE'
                SET user_topics= user_topics- 1
                WHERE user_id= '
$post_info['user_id']. '
                AND user_topics> 0'
;
            
$db-> sql_query$sql );

            
$sql'UPDATE 'USERS_TABLE'
                SET user_topics= user_topics+ 1
                WHERE user_id= '
$userdata['user_id'];
            
$db-> sql_query$sql );
        }
        
/*** 2013-10-15 END ***/  
Tested.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
AmigoJack
Registered User
Posts: 6109
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Bug: changing post author is not handled

by PiperB » Sat Jun 24, 2017 2:38 am

Thank you for this fix, it works perfect.
<!-- IF U_LOVE_NOTEPAD++ -->
[td class=statement]I Notepad++ ![/td]
<!-- ENDNEVER --> <!-- tee hee --> :P
Whoa ooo whoa ooo whoa I'm a Lady!
User avatar
PiperB
Registered User
Posts: 173
Joined: Mon Nov 07, 2016 6:54 pm
Contact: