Gossamer Forum
Quote Reply
Hook not found...
Hi there,

I have created a plugin that autovalidates links based on a user trustlevel.
It works excellent. But in one of the GLinks 3.2.0 installations I recieve the
following error when a new link is added.

[Fri Mar 7 00:35:45 2008] [error] GT::Plugins (17296): Error running plugin 'POST' hook 'Plugins::AutoValidate::post_add_link': Plugins::AutoValidate::post_add_link does not exist in Plugins/AutoValidate at /home/basejumper/basejumper.com/cgi-bin/cms/admin/Links/Table/Links.pm line 88.\n


The installation's name is "videos"

Thanks Frown


Sacrifice is not about what you lose,
it is about what you gain in the process.

Last edited by:

EZFrag: Mar 7, 2008, 12:46 AM
Quote Reply
Re: [EZFrag] Hook not found... In reply to
Hi,

Quote:
[Fri Mar 7 00:35:45 2008] [error] GT::Plugins (17296): Error running plugin 'POST' hook 'Plugins::AutoValidate::post_add_link': Plugins::AutoValidate::post_add_link does not exist in Plugins/AutoValidate at /home/basejumper/basejumper.com/cgi-bin/cms/admin/Links/Table/Links.pm line 88.\n
Does post_add_link() exist in Plugins/AutoValidate.pm ?

That what the error messages seems to be indications - so could be the file is corrupt, or similar.

Hope that helps.

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!
Quote Reply
Re: [Andy] Hook not found... In reply to
Yes it is there. Here is the code:
Code:

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

my (@args) = @_;
my $max_id = $DB->table('Links')->select( ['MAX(ID)'] )->fetchrow;
my $table = $DB->table('Links');
my $sth = $table->select('isValidated',{ID => $max_id } );
my $back;

while (my $hit = $sth->fetchrow_hashref) {
$back .= qq|$hit->{isValidated}|;

}

my $link = $DB->table('Links')->select( { ID => $max_id } )->fetchrow_hashref;
if($back eq 'Yes')
{
use Plugins::ConvertVideo;
my $link2 = Plugins::ConvertVideo::convert_video($link );
$DB->table('Links')->update( $link2, { ID => $max_id } );
}
return @args;
}


Sacrifice is not about what you lose,
it is about what you gain in the process.
Quote Reply
Re: [EZFrag] Hook not found... In reply to
Hi,

Mmm. odd :/ I can't see any reason why it would give that problem :/

BTW - this may be a little bit quicker - not that it really matters, but hey ho :D

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

my (@args) = @_;
my $max_id = $DB->table('Links')->select( ['MAX(ID)'] )->fetchrow;
my $table = $DB->table('Links');
my $isval = $table->select( ['isValidated'], {ID => $max_id } )->fetchrow;

my $link = $DB->table('Links')->select( { ID => $max_id } )->fetchrow_hashref;
if($isval eq 'Yes') {
use Plugins::ConvertVideo;
my $link2 = Plugins::ConvertVideo::convert_video($link );
$DB->table('Links')->update( $link2, { ID => $max_id } );
}
return @args;

}

Just saves doing a while() loop, when you only wanna get one result :)

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!