PDA

View Full Version : Hooks Question


DJ29Joesph
07-03-2009, 06:12 AM
I have a hook that I want to add to the admincp login page. I know I have to use adminfunctions.php. The question I have is I have a hook that usually goes in the navbar near the login and submit buttons. Anyway I'm trying to add the hook and I know I have to use

($hook = vBulletinHook::fetch_hook('hook_name_here')) ? eval($hook) : false;
But the question I have is how do I add it so it is in php? Do I have to do it in php? Mainly, what am I doing wrong?

Heres what I think it is (yes I know I did change hook_name_here):


<!-- submit row -->
<tbody>
<tr>
<td colspan="3" align="center"><div style="float: right">
<?php ($hook = vBulletinHook::fetch_hook('hook_name_here')) ? eval($hook) : false; ?></div>
<input type="submit" class="button" value=" <?php echo $vbphrase['log_in']; ?> " accesskey="s" tabindex="3" />
<?php if ($showoptions) { ?><input type="button" class="button" value=" <?php echo $vbphrase['options']; ?> " accesskey="o" onclick="js_show_options('loginoptions', this)" tabindex="4" /><?php } ?>
</td>
</tr>
</tbody>
<!-- /submit row -->
The main thing I'm changing (or adding) is:


<div style="float: right">
<?php ($hook = vBulletinHook::fetch_hook('hook_name_here')) ? eval($hook) : false; ?></div>
Any help would be great, thanks!

Lynne
07-03-2009, 02:12 PM
You need to add a file to the includes/xml directory that defines your hook so it will show up in the hook location dropdown. Take a look at the existing files in there and you should get a good idea of what to do. Post back if you can't figure it out.

DJ29Joesph
07-03-2009, 03:12 PM
I'm going to take the wildest guess here, I'm guessing in the adminfunctions.php I have to put:


<?php ($hook = vBulletinHook::fetch_hook('xml_file_here')) ? eval($hook) : false; ?>

and in the xml file I have to put:


<?xml version="1.0" encoding="ISO-8859-1"?>

<hooks>

<hooktype type="another_name_here">
<hook>hook_name_here</hook>
</hooktype>

</hooks>


Am I anywhere close? Thanks Lynne!

Lynne
07-03-2009, 08:01 PM
It looks right - just try it and you'll see.

DJ29Joesph
07-03-2009, 10:01 PM
It still doesn't work. Any other ideas?

Also is it...


<?php ($hook = vBulletinHook::fetch_hook('xml_file_here')) ? eval($hook) : false; ?>


or


<?php echo ($hook = vBulletinHook::fetch_hook('xml_file_here')) ? eval($hook) : false; ?>


either way I tried both ways!

Lynne
07-04-2009, 12:55 AM
If you are creating a php hook, then you need to add it to the php page. You just make it look like any other evaled hook in a php page. You should not be echoing the hook like you are.