Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 12-10-2002, 08:38 PM
Grendel's Avatar
Grendel Grendel is offline
 
Join Date: Jul 2002
Location: Germany
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Posting-Counter for special forums

What I need:

I want to show the total count of postings a user has made (already integrated in vb).
BUT:
I also want to show, how many postings a user has made in
- forum 1, 2, 4, 6, 10 and in
- forum 3, 5, 7, 8, 9

Is this possible?
Reply With Quote
  #2  
Old 12-10-2002, 09:48 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

where do you want to show it?

in getinfo or in every post?
Reply With Quote
  #3  
Old 12-11-2002, 09:21 AM
Grendel's Avatar
Grendel Grendel is offline
 
Join Date: Jul 2002
Location: Germany
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In every post.
But if that means to much queries I would be satisfied with getinfo too
Reply With Quote
  #4  
Old 12-11-2002, 12:00 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well in every post would mean at least hacking of a lot of files, or really increasing the ammount of queries, so i'd say we shouldn't do this

for getinfo it's nor problem:

open member.php
find
PHP Code:
  $jointime = (time() - $userinfo[joindate]) / 86400// Days Joined
  
if ($jointime 1) { // User has been a member for less than one day.
    
$postsperday "$userinfo[posts]";
  } else {
    
$postsperday sprintf("%.2f",($userinfo[posts] / $jointime));
  } 
before (or below, it's equal ) add this:
PHP Code:
$forumposts $DB_site->query_first("SELECT SUM(IF(thread.forumid IN (1, 2, 4, 6, 10), 1, 0) as first, SUM(IF(thread.forumid IN (3, 5, 7, 8, 9), 1, 0) as second FROM post LEFT JOIN thread USING(threadid)"); 
then you should be able to use $forumposts[first] and $forumposts[second] in your getinfo-template, put it where you want
Reply With Quote
  #5  
Old 12-11-2002, 01:25 PM
Grendel's Avatar
Grendel Grendel is offline
 
Join Date: Jul 2002
Location: Germany
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think some brackets are missing (the IF is not closed). SQL-Error, if I try it like you wrote. If I add some brackets:
Code:
$forumposts = $DB_site->query_first("SELECT SUM(IF(thread.forumid IN (1, 2, 4, 6, 10), 1, 0)) as first, SUM(IF(thread.forumid IN (3, 5, 7, 8, 9), 1, 0)) as second FROM post LEFT JOIN thread USING(threadid)");
(no sql error) the count is wrong:

2973 (48935/44152)

First number is the whole count, second the $forumposts[first], last the $forumposts[second]

Any guesses?
Reply With Quote
  #6  
Old 12-11-2002, 01:29 PM
Grendel's Avatar
Grendel Grendel is offline
 
Join Date: Jul 2002
Location: Germany
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That means right now its counting all posts - but it only should count the posts of a specific user.
Reply With Quote
  #7  
Old 12-11-2002, 01:47 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

damn, of course you're right
i had it in my mind, but forgot to write it down also...

also damn brackets

use this one:
PHP Code:
$forumposts $DB_site->query_first("SELECT SUM(IF(thread.forumid IN (1, 2, 4, 6, 10), 1, 0)) as first, SUM(IF(thread.forumid IN (3, 5, 7, 8, 9), 1, 0)) as second FROM post LEFT JOIN thread USING(threadid) WHERE userid=$userinfo[userid]"); 
Reply With Quote
  #8  
Old 12-11-2002, 02:07 PM
Grendel's Avatar
Grendel Grendel is offline
 
Join Date: Jul 2002
Location: Germany
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works!

Great! Big "Thank you" for your quick help!
Reply With Quote
  #9  
Old 12-11-2002, 02:09 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default


good to hear

you're welcome
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:27 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03895 seconds
  • Memory Usage 2,243KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete