Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Plugin Hooks (enable/disable)

Quote Reply
Plugin Hooks (enable/disable)
There is a checkbox to enable/disable hooks on Plugin Details.

Do "I" have to run/not_run my plugin code based on this setting? or does my plugin *not* get called automatically if this checkbox is set to "disable"?

I ask because I see in Andy's SearchFeed plugin, he has this code in Install.pm
Code:
$mgr->install_options ( 'SearchFeed_Results', [ ['Active', '1', 'Set to 0 if you don\'t want this plugin to be active, or 1 if you want the results to be grabbed...', 'TEXT', [], [], '' ] ] );

and this in his hook...
Code:
my $opts = Links::Plugins->get_plugin_user_cfg ('SearchFeed_Results');
my $inc = $opts->{Active};

if ($inc == 0) { return $results; }
if ($inc == 1 and $results->{link_hits} > 0) { return $results; }


I have *not* added ANY special option to enable/disable my plugin, yet I still have the checkboxes in Plugin Details.

So, do I have to add an option to run/not run my hook?
Or, can I just grab the GT setting on this hook and run/ not run based on that?

How do I access the enabled disabled setting from plugin config options?
Code:
'ZipCodeSearch' => {
'hooks' => [
[
'add_link',
'PRE',
'Plugins::ZipCodeSearch::add_link_hook',
'1'
],
[
'modify_link',
'PRE',
'Plugins::ZipCodeSearch::modify_link_hook',
'1'
]
],

I hope you understand what I am asking.

Thanks,
Chris
RGB World, Inc. - Software & Web Development.
rgbworld.com
Subject Author Views Date
Thread Plugin Hooks (enable/disable) rgbworld 4123 May 26, 2005, 7:30 AM
Thread Re: [rgbworld] Plugin Hooks (enable/disable)
rgbworld 4060 May 26, 2005, 7:49 AM
Thread Re: [rgbworld] Plugin Hooks (enable/disable)
rgbworld 4038 May 28, 2005, 5:33 PM
Thread Re: [rgbworld] Plugin Hooks (enable/disable)
rgbworld 3892 Jun 18, 2006, 7:58 PM
Thread Re: [rgbworld] Plugin Hooks (enable/disable)
rgbworld 3875 Aug 17, 2006, 11:02 PM
Post Re: [rgbworld] Plugin Hooks (enable/disable)
fuzzy logic 3850 Aug 18, 2006, 12:13 AM
Thread Re: [rgbworld] Plugin Hooks (enable/disable)
pugdog 3815 Aug 28, 2006, 4:57 PM
Post Re: [pugdog] Plugin Hooks (enable/disable)
rgbworld 3800 Aug 28, 2006, 6:31 PM