1 balupton Apr 18, 2006 04:33
3 balupton Apr 18, 2006 12:09
Also when a setting is disabled it passes a null value back to the form so to fix that the following addition is made;
Change [Around line 272 - \blogs\inc\_misc\_plugins.funcs.php]
function set_Settings_for_Plugin_from_params( & $Plugin, & $use_Plugins, $set_type )
{
global $Request, $Messages;
$method = 'GetDefault'.$set_type;
foreach( $Plugin->$method() as $l_name => $l_meta )
{
if( isset($l_meta['layout']) )
{ // a layout "setting"
continue;
}
to
function set_Settings_for_Plugin_from_params( & $Plugin, & $use_Plugins, $set_type )
{
global $Request, $Messages;
$method = 'GetDefault'.$set_type;
foreach( $Plugin->$method() as $l_name => $l_meta )
{
if( isset($l_meta['layout']) )
{ // a layout "setting"
continue;
}
if( isset($l_meta['disabled']) )
{ // when a setting is disabled we don't want a null value
$l_value = $Plugin->$set_type->get( $l_name );
continue;
}
4 personman Apr 18, 2006 15:19
balupton,
Grab blueyed's captcha plugin from the same repository where my youtube plugin is. He uses the BeforeEnable event to check to see if the server has GD installed. If not it gives an error message and fails to enable the plugin. You should be able to modify his method for your purposes.
5 balupton Apr 18, 2006 15:30
Yes i know but the GD library is optional in this plugin not like the captcha plugin.
Having the GD library installed is a benefit because then they can enable thumbnails, if the admin wants.
But the plugin will work fine without thumbnails
6 blueyed Apr 18, 2006 19:07
Thanks balupton.
I've slightly changed your code and just committed it.
Your code should still work, though you should say
'disabled' => true
in your GetDefaultSettings method.
Allright i've implemented what I wanted to do above into b2evolution 1.8, heres how;
Add this to line 151 of blogs\inc\_misc\_plugins.funcs.php
Will allow this to work