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 08-10-2007, 10:11 AM
ThreeD ThreeD is offline
 
Join Date: Aug 2006
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Display $jointime with hook?

What code do I have to use to calculate the $jointime with a hook? I found postbit_display_start ($jointime = (TIMENOW - $this->post['joindate']) / 86400; ) but that doesn't work when I try to display the date in the showgroups template.
Reply With Quote
  #2  
Old 08-10-2007, 10:16 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try using $user['joindate'] instead of $this->post['joindate'].
Reply With Quote
  #3  
Old 08-10-2007, 11:07 AM
ThreeD ThreeD is offline
 
Join Date: Aug 2006
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Opserty, to be honest I don't know if I implemented the hook correctly. If I want to create a hook to display a members jointime correctly in showgroups.php what hook location do I have to use? showgroups_user or something else?
Reply With Quote
  #4  
Old 08-10-2007, 11:17 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Look in the PHP file, you can then tell where you'll need to hook it.
Reply With Quote
  #5  
Old 08-10-2007, 11:28 AM
ThreeD ThreeD is offline
 
Join Date: Aug 2006
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks dismounted, but I meant how do I know what the hook location has to be when I create the NEW plugin/hook? I created a new hook with the info opserty gave me,

Product: vbulletin
Hook location: showgroups_user? <- This is the one I am not sure if is correct?
title: showgroups_userjd
execution order: 5
Plugin php code: $user['joindate'] instead of $this->post['joindate']

Should the hook location be showgroups_start or is showgroups_user correct?
Reply With Quote
  #6  
Old 08-10-2007, 11:45 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

showgroups_user should be fine.
Reply With Quote
  #7  
Old 08-10-2007, 12:02 PM
ThreeD ThreeD is offline
 
Join Date: Aug 2006
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok thanks Opserty. So I've created the hook! Should I insert the hook before the function is called in the showgroups.php file?

($hook = vBulletinHook::fetch_hook('showgroups_userjd')) ? eval($hook) : false;
Reply With Quote
  #8  
Old 08-10-2007, 12:06 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A hook is a place where the plugins are attached to, i.e. where they are code is hooked to the PHP file to run. The whole point of hooks is to avoid editing the PHP files

Just Add a new Plugin with the hook location set to showgroups_user.
Reply With Quote
  #9  
Old 08-10-2007, 12:16 PM
ThreeD ThreeD is offline
 
Join Date: Aug 2006
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh hehe, ok I added the new plugin. So if I don't have to call the hook in showgroups.php or the showgroups template, how on earth does vbulletin know how to calculate the correct joindate of the staff when members visit showgroups.php?
Reply With Quote
  #10  
Old 08-10-2007, 12:20 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<font face="Courier New">$user['joindate']</font> is fetched from the database for each specific user. It already does this in the PHP and the plugin just uses the data which has already been fetched.
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 07:23 AM.


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.04868 seconds
  • Memory Usage 2,246KB
  • 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)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
  • (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_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