vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Posting-Counter for special forums (https://vborg.vbsupport.ru/showthread.php?t=46557)

Grendel 12-10-2002 08:38 PM

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?

Xenon 12-10-2002 09:48 PM

where do you want to show it?

in getinfo or in every post?

Grendel 12-11-2002 09:21 AM

In every post. :)
But if that means to much queries I would be satisfied with getinfo too ;)

Xenon 12-11-2002 12:00 PM

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 ;)

Grendel 12-11-2002 01:25 PM

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?

Grendel 12-11-2002 01:29 PM

That means right now its counting all posts - but it only should count the posts of a specific user.

Xenon 12-11-2002 01:47 PM

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]"); 


Grendel 12-11-2002 02:07 PM

Works!

Great! Big "Thank you" for your quick help!

Xenon 12-11-2002 02:09 PM

:)
good to hear :)

you're welcome


All times are GMT. The time now is 06:28 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.01454 seconds
  • Memory Usage 1,730KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete