Enable plugin on install

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Hi Guys,

Is there anyway to programatically default a plugin to enabled when it installs?

Thanks
7 years ago
Hey,

have a look at WidgetUpdate method of WidgetController. It has the following lines:
//mark as active
_widgetSettings.ActiveWidgetSystemNames.Add(widget.PluginDescriptor.SystemName);
_settingService.SaveSetting(_widgetSettings);

There is the same methods for External authentication methods (MethodUpdate, ExternalAuthenticationController), Shipping providers (ProviderUpdate, ShippingController) etc, where you can find that setting you have to update to mark a plugin as active.
7 years ago
Brilliant, that worked thank you. Is there a way to do it for misc plugins as well?

Thanks
2 years ago
using 4.1 we can set plugin as installed below this code

public override void Install()
        {
            PluginManager.MarkPluginAsInstalled(PluginDescriptor.SystemName);
        }

For uninsatlled

public override void Uninstall()
        {
            PluginManager.MarkPluginAsUninstalled(PluginDescriptor.SystemName);
        }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.