vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Display $jointime with hook? (https://vborg.vbsupport.ru/showthread.php?t=154841)

ThreeD 08-10-2007 10:11 AM

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.

Opserty 08-10-2007 10:16 AM

Try using $user['joindate'] instead of $this->post['joindate'].

ThreeD 08-10-2007 11:07 AM

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?

Dismounted 08-10-2007 11:17 AM

Look in the PHP file, you can then tell where you'll need to hook it.

ThreeD 08-10-2007 11:28 AM

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?

Opserty 08-10-2007 11:45 AM

showgroups_user should be fine.

ThreeD 08-10-2007 12:02 PM

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;

Opserty 08-10-2007 12:06 PM

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

Just Add a new Plugin with the hook location set to showgroups_user.

ThreeD 08-10-2007 12:16 PM

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?

Opserty 08-10-2007 12:20 PM

<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.


All times are GMT. The time now is 01:52 AM.

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.01123 seconds
  • Memory Usage 1,725KB
  • 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
  • (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