• Resolved jenkisan

    (@jenkisan)


    For some reason the defaults I was setting in the file were not being executed on plugin activation.

    I change the register_activation_hook and simplified it and now it works. Not sure what the other bits were trying to do.

    Now, with this simplification, when the plugin is activated the defaults settings are set (especially important for ffmpeg path, watermark, vpre settings etc). A user can still set his own and save afterwards.

    (line 95-115)

    function kgvid_register_default_options_fn() { //add default values for options
    $options = kgvid_default_options_fn();
    update_option(‘kgvid_video_embed_options’, $options);
    }
    register_activation_hook(__FILE__, ‘kgvid_register_default_options_fn’);

    Cheers.

    http://wordpress.org/plugins/video-embed-thumbnail-generator/

Viewing 1 replies (of 1 total)
  • Plugin Author Kyle Gilman

    (@kylegilman)

    Feel free to modify the plugin in any way that works with what you need it to do, but for most users plugin options aren’t supposed to reset when you reactivate the plugin. Default settings are only set the first time you activate the plugin and are saved in the database until you uninstall the plugin. That way you don’t lose your custom plugin settings, since most users don’t go through the extra step of modifying the default settings in the code.

    In order to reset to default settings, you can hit the “Reset Options” button at the bottom of the plugin’s settings page.

Viewing 1 replies (of 1 total)
  • The topic ‘Register_Activation_Hook and Defaults Not Setting’ is closed to new replies.