Gossamer Forum
Quote Reply
Hooks not working"
I'm working on the Ace_Category plugin...which will allow users to submit a category before adding their link. The problem I am having, is that the hook doesn't appear to be working!

This is the code I have in Install.pm regarding to the hooks;

$mgr->install_hooks ( 'Ace_Category', [ ['add_link', 'PRE', 'Plugins::Ace_Category::add_link', 'FIRST'] ]);
$mgr->install_hooks ( 'Ace_Category', [ ['add_link', 'PRE', 'Plugins::Ace_Category::add_link2', 'LAST'] ]);

ANd the sub relating to it, in Ace_Category.pm, is;

Code:
sub add_link {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'add_link'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#

print $IN->header();
print "test";
exit;

my (@args) = @_;

my $table = $DB->table('Category');
my $sth = $table->select;
my $opts;

# grab all the money, and add it up...
while (my $hit = $sth->fetchrow_hashref) {

$opts .= "<option value=\"$hit->{ID}\">$hit->{Full_Name}</option>"

}

my $category = qq|
<select size="1" name="new_category_sub">
$opts
</select>
|;

print $IN->header();
print Links::SiteHTML::display('pre_add_link', { category_list => $category });
exit;

return @args;
}

Can anyone see anything that may cause the hook not to be called? After installing it, and running add.cgi, all I get is the normal adding page! Crazy

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Hooks not working" Andy 10867 Oct 9, 2002, 7:29 AM
Thread Re: [Andy] Hooks not working"
Paul 10634 Oct 9, 2002, 7:33 AM
Thread Re: [Paul] Hooks not working"
Andy 10621 Oct 9, 2002, 7:36 AM
Thread Re: [Andy] Hooks not working"
webmaster33 10573 Oct 9, 2002, 11:25 PM
Thread Re: [webmaster33] Hooks not working"
Andy 10603 Oct 10, 2002, 12:22 AM
Thread Re: [Andy] Hooks not working"
Paul 10596 Oct 10, 2002, 2:54 AM
Thread Re: [Paul] Hooks not working"
Andy 10578 Oct 10, 2002, 2:56 AM
Thread Re: [Andy] Hooks not working"
yogi 10609 Oct 10, 2002, 3:06 AM
Thread Re: [yogi] Hooks not working"
Andy 10599 Oct 10, 2002, 3:07 AM
Thread Re: [Andy] Hooks not working"
Paul 10553 Oct 10, 2002, 3:13 AM
Thread Re: [Paul] Hooks not working"
Andy 10572 Oct 10, 2002, 3:50 AM
Thread Re: [Andy] Hooks not working"
Paul 10646 Oct 10, 2002, 5:24 AM
Thread Re: [Paul] Hooks not working"
Andy 10678 Oct 10, 2002, 6:28 AM
Thread Re: [Andy] Hooks not working"
yogi 10566 Oct 10, 2002, 6:31 AM
Thread Re: [yogi] Hooks not working"
Andy 10572 Oct 10, 2002, 6:34 AM
Thread Re: [Andy] Hooks not working"
yogi 10585 Oct 10, 2002, 6:39 AM
Thread Re: [yogi] Hooks not working"
Andy 10693 Oct 10, 2002, 7:31 AM
Thread Re: [Andy] Hooks not working"
Andy 10591 Oct 11, 2002, 1:46 AM
Thread Re: [Andy] Hooks not working"
yogi 10574 Oct 11, 2002, 1:54 AM
Post Re: [yogi] Hooks not working"
Andy 10560 Oct 11, 2002, 1:57 AM
Post Re: [yogi] Hooks not working"
Andy 10498 Nov 26, 2002, 2:28 AM