vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Posts per day (https://vborg.vbsupport.ru/showthread.php?t=30318)

Mike Gaidin 10-14-2001 03:52 AM

Is there any hack that will allow me to to add a poster's posts per day (like the one that's shown in the profiles) under the avatar? I think it should be easy, but I know nothing of php yet to figure it out for myself.

Reeve of shinra 10-14-2001 07:07 AM

You can find the variable string used to display that in a template you can reach from your admin panel. Then just copy and paste that in the post-bit template under the advatar somewhere.

JamesUS 10-14-2001 07:36 AM

Actually this does require a code hack. You need to put this block of code:
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));
  } 

directly under line 265 of admin/functions.php

Then into the postbit template, add $postsperday.

I haven't tested this at all but it should work.

Freddie Bingham 10-14-2001 03:06 PM

Just stick $postsperday into the postbit template and you will have what you want since I created the value to be used but don't display it by default.

Mike Gaidin 10-14-2001 03:40 PM

Great! Thanks for your help! :D

Crapforum 01-18-2002 02:45 PM

Quote:

Originally posted by JamesUS
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));
  } 


Is it possible to run this code agains the db to get the user with the highest post per day?

Something like a "user of the day hack" :)

I tried it myself but i don't no how to do calculations with fieldvalues in a loop.

tia,
www.crapforum.nl

Admin 01-18-2002 03:38 PM

I don't really understand what you are trying to do, but anyhow this code will give you the userid,username,postsperday and posts of the user with the highest posts per day ranking:
Code:

$user=$DB_site->query_first("SELECT userid,username,posts,(posts/((UNIX_TIMESTAMP(NOW())-joindate)/86400)) AS postsperday FROM user ORDER BY postsperday DESC");
Have fun. ;)

Crapforum 01-20-2002 06:10 PM

Thx for giving me some pointers here :)

i've got it working now.

you can checkit out on my forum.

www.crapforum.nl

topright "poster of the day"

squawell 01-21-2002 08:43 AM

Quote:

Originally posted by FireFly
I don't really understand what you are trying to do, but anyhow this code will give you the userid,username,postsperday and posts of the user with the highest posts per day ranking:
Code:

$user=$DB_site->query_first("SELECT userid,username,posts,(posts/((UNIX_TIMESTAMP(NOW())-joindate)/86400)) AS postsperday FROM user ORDER BY postsperday DESC");
Have fun. ;)

where should i put this code??

functions or other else~~~??

could someone tell me??

Brian 02-11-2002 09:00 PM

I want to add this to the memberlist area. However when I do this it shows 0.00 for the posts per day :/

In memberlist.php on the top I added

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

And then used the variable $postsperday in the memberlistbit template but it outputs 0.00 instead of their avb posts per day :/

Can anyone help :)

-Brian


All times are GMT. The time now is 04:41 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.01266 seconds
  • Memory Usage 1,744KB
  • 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
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_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
  • (10)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