1. 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

Discussion in 'XenForo Development Discussions' started by Tom Christian, Oct 12, 2014.

  1. Tom Christian

    Tom Christian Active Member

    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.
  2. Chris D

    Chris D XenForo Developer Staff Member

    Yep, just add this code to the top of the validation callback:

    if ($dw->isInsert())
    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.
    Tom Christian likes this.
  3. Tom Christian

    Tom Christian Active Member

    Makes sense, thanks!

Share This Page