• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Unable to install plugin due to validation callback

#1
I've built a plugin locally and now I want to install it on my online site.

However, I'm unable to import the plugin as a condition within my validation callback class is firing DURING the import? Is this standard behavior?

One of the conditions in my validation callback was to ensure a field was not blank so obviously it's returning false and therefore preventing the plugin from installing.

Any help is much appreciated.
 

Chris D

XenForo developer
Staff member
#2
Yep, just add this code to the top of the validation callback:

PHP:
if ($dw->isInsert())
{
    return true;
}
In this context the $dw is the Option DataWriter and it is currently inserting the new option and setting the default value. So isInsert() is only ever going to be true during add-on install, so in that context it is perfectly safe to escape out of the validation with the above code.
 
#3
Yep, just add this code to the top of the validation callback:

PHP:
if ($dw->isInsert())
{
    return true;
}
In this context the $dw is the Option DataWriter and it is currently inserting the new option and setting the default value. So isInsert() is only ever going to be true during add-on install, so in that context it is perfectly safe to escape out of the validation with the above code.
Makes sense, thanks!