The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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.
|
#2
|
|||
|
|||
Try using $user['joindate'] instead of $this->post['joindate'].
|
#3
|
|||
|
|||
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?
|
#4
|
||||
|
||||
Look in the PHP file, you can then tell where you'll need to hook it.
|
#5
|
|||
|
|||
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? |
#6
|
|||
|
|||
showgroups_user should be fine.
|
#7
|
|||
|
|||
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; |
#8
|
|||
|
|||
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. |
#9
|
|||
|
|||
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?
|
#10
|
|||
|
|||
<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.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|