PDA

View Full Version : Posts per day


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:

$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
Originally posted by JamesUS

$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:
$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
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:
$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


$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

Brian
02-13-2002, 10:24 PM
Anyone have a clue lol :)

-Brian

jibious
03-30-2003, 10:28 PM
in memberlist.php

find:

if ($userinfo[yahoo]!="") {
eval("\$userinfo[yahooicon] = \"".gettemplate("yahoo")."\";");
} else {
$userinfo[yahoo]="&nbsp;";
}

after, add:

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

in memberlist template:

replace:

<td bgcolor="{ categorybackcolor }" colspan="6">

with:

<td bgcolor="{ categorybackcolor }" colspan="7">

find:

<td bgcolor="{ tableheadbgcolor }" align="center"><smallfont color="{ tableheadtextcolor }"><b>Posts</b></smallfont></td>

after, add:

<td bgcolor="{ tableheadbgcolor }" align="center"><smallfont color="{ tableheadtextcolor }"><b>Posts Per Day</b></smallfont></td>

in memberlistbit template:

find:

<td bgcolor="{ secondaltcolor }"><normalfont>$userinfo[posts]</normalfont></td>

after, add:

<td bgcolor="{ firstaltcolor }"><normalfont>$postsperday</normalfont></td>

*note: remove the spaces between { }.

mhmd1983
07-01-2008, 08:42 AM
How can i use this variable in global Vbulletin , i need to use it in other templates like Vbadvanced