Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 10-02-2002, 09:05 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks pal

i found out the same way yesterday night, after reading a book about mysql functions....
Reply With Quote
  #12  
Old 10-02-2002, 03:34 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

haha cool... so that is all it takes logician?

- miSt
Reply With Quote
  #13  
Old 10-02-2002, 04:44 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Mist
haha cool... so that is all it takes logician?
well I didnt test it myself but it seems ok so yes, it is all it takes..
Reply With Quote
  #14  
Old 10-02-2002, 06:33 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

does it add any extra queries on any of the pages??

- miSt
Reply With Quote
  #15  
Old 10-02-2002, 08:16 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Mist
does it add any extra queries on any of the pages??
- miSt
Yes it adds 1 query.. (Whenever you see a "..$DB_site->query..." term in a hack code, automatically add 1 query)

If you add the hack to global.php, the variable will be accessible in the entire vb scripts and 1 extra query will be added to all vb pages.

On the other hand you might want to consider adding the line to the relevant script if you only want to use it in a particular place like getinfo template(= User Info Page). Then 1 query will be added only when that particular page is loaded..

Your call..
Reply With Quote
  #16  
Old 10-03-2002, 03:37 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes i'll probably use it in member.php

Thanks a lot Logician

- miSt
Reply With Quote
  #17  
Old 09-11-2007, 11:16 PM
Charles_1 Charles_1 is offline
 
Join Date: Jun 2006
Location: Czech Republic, Brno
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xenon View Post
you can try that:

open functions.php find:
PHP Code:
    // do posts from ignored users
    
if (($ignore[$post[userid]] and $post[userid] != 0)) {
        eval(
"\$retval = \"".gettemplate("postbit_ignore")."\";"); 
before that add:
PHP Code:
$post[numchars]=strlen($post[pagetext]); 
then add $post[numchars] in your postbit template
Hi Xenon,

I did my search here, but I found only old topics regarding my need. I need counting of characters for each post in one specific forum, but solution that you wrote, is not applicable to present version of vBulletin (3.6.x). I tried to look for mentioned lines in file functions.php, but without success (which is not surprise after 5 years of modifications of vB). So could you please provide to me solution for actual version of vB? I just need that posts in one specific forum would have information about number of characters included in them. Nothing more :-).
Reply With Quote
  #18  
Old 03-22-2008, 05:48 PM
Taragon's Avatar
Taragon Taragon is offline
 
Join Date: Sep 2007
Location: The Netherlands
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Logician View Post
If you are trying to calculate the total number of characters a user posted to your board, maybe you can find this easier to adopt. Basically 1 SQL query can calculate it easily:

SELECT SUM(LENGTH(pagetext)) FROM `post` WHERE userid=X

You can integrate it to vb like:

PHP Code:
$charcount=$DB_site->query_first("SELECT SUM(LENGTH(pagetext)) as char FROM `post` WHERE userid='$bbuserinfo[userid]'");
$bbuserinfo['charcount']=$charcount['char']; 
by adding this at the end of say, global.php. Then you can use the variable $bbuserinfo['charcount'] in any template you want (like getinfo etc.). This might not work for postbit, but there is also a solution for this if you are tying to implement it into postbit..

One obvious advantage of making a dynamic query is that the number returned will be always up to date after message editing, deleting etc.

Enjoy..
Very sorry for bumping this old request , but would this still work with vb 3.6/3.7?

Currently I'm running into this db error:

Code:
Database error in vBulletin 3.7.0 Release Candidate 1:

Invalid SQL:
SELECT SUM(LENGTH(pagetext)) as char FROM `post` WHERE userid='';

MySQL Error   : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'char FROM `post` WHERE userid=''' at line 1
Error Number  : 1064
Date          : Saturday, March 22nd 2008 @ 01:46:55 PM
Script        : http://www.letsgather.net/demo/
Referrer      : 
IP Address    : 62.166.43.206
Username      : Taragon
Classname     : vB_Database
MySQL Version : 4.1.22-standard
Reply With Quote
  #19  
Old 03-22-2008, 06:43 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow.. A bump after 6 years!

Code for 3.6-3.7 must be:

$charcount=$db->query_first("SELECT SUM(LENGTH(pagetext)) as char FROM `post` WHERE userid='".$vbulletin->userinfo[userid]."'");
$vbulletin->userinfo['charcount'] = $charcount['char'
];


However this adds 1 query to each page load and I don't suggest using it in a heavy traffic/busy board or forum with a lot of posts. It is neither optimized, nor a clean hack!


Reply With Quote
  #20  
Old 03-22-2008, 08:45 PM
Taragon's Avatar
Taragon Taragon is offline
 
Join Date: Sep 2007
Location: The Netherlands
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks! And sorry again for the bump.
I was looking for something, and this was the only similar thing I could find.
Reply With Quote
Reply


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 03: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.10829 seconds
  • Memory Usage 2,269KB
  • Queries Executed 11 (?)
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
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete