vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to Update Post Count for a Single User (https://vborg.vbsupport.ru/showthread.php?t=189413)

Lynne 08-29-2008 04:03 PM

Have you tried looking at the query in the admin cp for updating the post counts and thought of just substituting the userid for this one user? (The below code is from misc.php under do=updateposts and is for 3.6.8.)

First you have to get the forums (basically only get the forumids of those that allow post counts):
Code:

$forums = $db->query_read("
        SELECT forumid
        FROM " . TABLE_PREFIX . "forum AS forum
        WHERE (forum.options & " . $vbulletin->bf_misc_forumoptions['countposts'] . ")
    ");
    $gotforums = '';

Then you update them. You need to put in the userid where it says $user[userid] and then the forums above where it says $gotforums. I mean, this is the actual query, but I would just do it as I said above.
Code:

$totalposts = $db->query_first("
            SELECT COUNT(*) AS posts FROM " . TABLE_PREFIX . "post AS post
            INNER JOIN " . TABLE_PREFIX . "thread AS thread USING (threadid)
            LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog_t ON (deletionlog_t.primaryid = thread.threadid AND deletionlog_t.type = 'thread')
            LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog_p ON (deletionlog_p.primaryid = post.postid AND deletionlog_p.type = 'post')
            WHERE post.userid = $user[userid] AND
                thread.forumid IN (0$gotforums) AND
                deletionlog_t.primaryid IS NULL AND
                deletionlog_p.primaryid IS NULL



All times are GMT. The time now is 11:34 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00936 seconds
  • Memory Usage 1,712KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete