vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Posts Per Day in POSTBIT (https://vborg.vbsupport.ru/showthread.php?t=299905)

maupassant 07-07-2013 05:50 PM

Posts Per Day in POSTBIT
 
Can someone tell me how to add Posts Per Day in POSTBIT, just under "Posts" ? I need to know the code and exactly where to put it in POSTBIT. Thanks.

Lynne 07-08-2013 02:30 AM

Have you done a search for a mod that does this?

maupassant 07-12-2013 01:27 AM

Yes I did. At vBulletin.com too. All the suggestions found are for vBulletin 3 only. And indeed I was able to display the info when we were with vBulletin 3. But not with vBulletin 4.

Lynne 07-12-2013 03:36 AM

Did you try to convert the mod to vb4 at all? It should only be a matter of changing the template and template rendering, I would think. (I'm also surprised it doesn't already exist because I thought I saw it.)

Simon Lloyd 07-12-2013 04:01 AM

I'm not up with rendering stuff in vb4 properly but you can use (untested) this kind of query and use the hook postbit_complete in a plugin
PHP Code:

$postdays $vbulletin->db->query_read("SELECT joindate,posts FROM " TABLE_PREFIX "user WHERE userid = $post[userid]");
{
$mpostdays $vbulletin->db->fetch_array($postdays);
         
$jd time()-$mpostdays['joindate'];
$mpsts $jd/$mpostdays['posts'];
echo 
$mpsts;


using $mpsts as the variable to show posts per day and of course you'll need a phrase for "Posts per day" (it already exists :))

CAG CheechDogg 07-12-2013 10:45 AM

@ Simon - how about adding it to postbit_legacy?

Simon Lloyd 07-12-2013 11:34 AM

It would be the same, you're simply using the variable $mpsts, like I said I don't know whether you can use that variable raw in vb4 or not (i'm sure Lynne will chip in :) (please!!)), also remember I haven't tested it, I just wrote it in notepad and plopped it in here :)

I should of also said you should use $mpsts = round($jd/$mpostdays['posts'];) (that shouldn't be a smiley it should be ; followed be ))
instead of $mpsts = $jd/$mpostdays['posts'];

maupassant 07-12-2013 11:58 AM

Where do I put it in postbit_legacy ?

kh99 07-12-2013 01:07 PM

I hope you don't mind if I add a few suggestions: the post author's posts and joindate (joindateline) are already available, so you don't need a query. You could use the template hook postbit_userinfo_right_after_posts so that you don't need to edit the template. So maybe something like this (using postbit_display_complete):

Code:

if (($days = round((TIMENOW-$post['joindateline']) / 86400)) <= 0)
{
  $days = 1;
}
$ppd = round($post['posts'] / $days, 2);
$template_hook['postbit_userinfo_right_after_posts'] .= "<dt>Posts Per Day</dt><dd>$ppd</dd>";


There is a phrase that says "Posts Per Day" but it isn't loaded for the showthread page, so if you need phrases or would rather use one, you'd have to load the 'user' phrases, or just create a new phrase using the 'postbit' phrase type.

Simon Lloyd 07-12-2013 06:23 PM

Quote:

Originally Posted by maupassant (Post 2433327)
Where do I put it in postbit_legacy ?

It's a plugin so it doesn't go in a template

Quote:

Originally Posted by kh99 (Post 2433333)
I hope you don't mind if I add a few suggestions: the post author's posts and joindate (joindateline) are already available, so you don't need a query. You could use the template hook postbit_userinfo_right_after_posts so that you don't need to edit the template. So maybe something like this (using postbit_display_complete):

Code:

if (($days = round((TIMENOW-$post['joindateline']) / 86400)) <= 0)
{
  $days = 1;
}
$ppd = round($post['posts'] / $days, 2);
$template_hook['postbit_userinfo_right_after_posts'] .= "<dt>Posts Per Day</dt><dd>$ppd</dd>";


There is a phrase that says "Posts Per Day" but it isn't loaded for the showthread page, so if you need phrases or would rather use one, you'd have to load the 'user' phrases, or just create a new phrase using the 'postbit' phrase type.

Hey Kevin, no problem, like I said I just knocked it up in notepad without checking anything else, yours is much better as there's no extra query :)


All times are GMT. The time now is 05:02 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.01054 seconds
  • Memory Usage 1,741KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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