Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-06-2001, 03:27 PM
cpriest's Avatar
cpriest cpriest is offline
 
Join Date: Nov 2001
Location: vienna, austria
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i am sorry if this was released before i thought maybe some non-php programmers might need it

#####open member.php

##find:
$userinfo=$DB_site->query_first("SELECT username,joindate,lastpost,usertitle,email,showema il,invisible,homepage,icq,aim,yahoo,biography,post s FROM user WHERE userid=$userid");

##add below:
$postinfo=$DB_site->query_first("select count(postid) as total_posts, sum(LENGTH(pagetext)) as total_chars from post where userid='$userid'");

$user_join_timestamp = date("U",$userinfo[joindate]);
$system_timestamp = date("U");
$ts_difference = round(($system_timestamp - $user_join_timestamp ) / 86400);
$average_posts = round($userinfo[posts] / $ts_difference ,2);
$average_chars_per_post = round($postinfo[total_chars] / $postinfo[total_posts]);

####open your getinfo template

##find:
$totalposts

##add next to it:
(An average of $average_posts posts per day with an averge of average_chars_per_post per post)


[EDIT]:
with this code it will also show average count of letters / post!!!!!
Reply With Quote
  #2  
Old 02-06-2001, 03:49 PM
Guest
 
Posts: n/a
Default

Looks pretty cool.

You said the code is crappy though...will it cause any unnecessary load time due to bad queries?

Is it optimized?
Reply With Quote
  #3  
Old 02-06-2001, 03:55 PM
Guest
 
Posts: n/a
Default

nono, no extra queries it just uses the variables it gets from the usual UserInfo queries anyway.
all it is, is some calculating, and it's optimized to my best knowledge

and i said it's crappy because it's really simple
Reply With Quote
  #4  
Old 02-07-2001, 04:47 PM
Guest
 
Posts: n/a
Default

just updated the code above to one more feature
Reply With Quote
  #5  
Old 02-07-2001, 05:08 PM
Guest
 
Posts: n/a
Default

fix
An average of $average_posts posts per day with an average of $average_chars_per_post per post

I'm also getting an error on line
$average_posts = round($userinfo[posts] / $duh,2);

Wrong parameter count for round()

ver. 1.1.3


And here's my formatting (no reason, just posting )
Code:
 total posts<br>
Average of $average_posts posts per day<br>
Average of $average_chars_per_post characters per post
Reply With Quote
  #6  
Old 02-07-2001, 07:23 PM
Guest
 
Posts: n/a
Default

Where do you get $duh?
Reply With Quote
  #7  
Old 02-07-2001, 09:50 PM
Guest
 
Posts: n/a
Default

woops i am sorry i had two different formats of the code, and i rewrote it with nicer variable names and forgot to change that one

now it should work
Reply With Quote
  #8  
Old 02-07-2001, 10:29 PM
Guest
 
Posts: n/a
Default

Still getting an error for
$average_posts = round($userinfo[posts] / $ts_difference ,2);

Warning: Wrong parameter count for round() in member.php3 on line 623
Reply With Quote
  #9  
Old 02-07-2001, 11:49 PM
Guest
 
Posts: n/a
Default

BlackJack i guess you're using php3 right ? unfortunately php3 doesnt support the precision in the round command
just replace the line with
$average_posts = round($userinfo[posts] / $ts_difference);
then, delete the ",2"
Reply With Quote
  #10  
Old 02-07-2001, 11:58 PM
Guest
 
Posts: n/a
Default

That did it. Thanks.
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 06:16 AM.


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.04014 seconds
  • Memory Usage 2,228KB
  • 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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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
  • (1)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete