Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 07-07-2013, 05:50 PM
maupassant maupassant is offline
 
Join Date: Feb 2009
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 07-08-2013, 02:30 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you done a search for a mod that does this?
Reply With Quote
Благодарность от:
Amaury
  #3  
Old 07-12-2013, 01:27 AM
maupassant maupassant is offline
 
Join Date: Feb 2009
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 07-12-2013, 03:36 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.)
Reply With Quote
  #5  
Old 07-12-2013, 04:01 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 )
Reply With Quote
Благодарность от:
CAG CheechDogg
  #6  
Old 07-12-2013, 10:45 AM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@ Simon - how about adding it to postbit_legacy?
Reply With Quote
  #7  
Old 07-12-2013, 11:34 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'];
Reply With Quote
  #8  
Old 07-12-2013, 11:58 AM
maupassant maupassant is offline
 
Join Date: Feb 2009
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where do I put it in postbit_legacy ?
Reply With Quote
  #9  
Old 07-12-2013, 01:07 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
2 благодарности(ей) от:
CAG CheechDogg, Simon Lloyd
  #10  
Old 07-12-2013, 06:23 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by maupassant View Post
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 View Post
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
Reply With Quote
Reply

Thread Tools
Display Modes

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:21 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04456 seconds
  • Memory Usage 2,279KB
  • Queries Executed 12 (?)
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
  • (2)bbcode_code
  • (1)bbcode_php
  • (2)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
  • (4)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete