vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Hooks Question (https://vborg.vbsupport.ru/showthread.php?t=217745)

DJ29Joesph 07-03-2009 06:12 AM

Hooks Question
 
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
PHP Code:

($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):

PHP Code:

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

PHP Code:

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

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

and in the xml file I have to put:

PHP Code:

<?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 Code:

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

or

PHP Code:

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


All times are GMT. The time now is 05:11 PM.

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.01225 seconds
  • Memory Usage 1,733KB
  • 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
  • (7)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete