Global plugin settings

Global plugin settings

Postby pwestbro on Thu Mar 22, 2007 5:40 am

When porting the hotlinkprevention plugin, and issue/question came up, and I wanted to mention it.

If I have a plugin that performs an action when enabled/disabled, is there a mechanism to:
1) run the plugin when it is enabled or disabled globally
2) run the plugin for every blog to perform that action when enabling/disabling
3) run the plugins when a new blog is created to perform that action

For example, for the hotlinkprevention plugin, when enabled globally, the plugin should either create an .htaccess file in the root gallery directory, or create an .htaccess in each of the blogs gallery directory.

It looks like right now, there is not event that gets sent when a plugin is enabled globally
pwestbro
 
Posts: 99
Joined: Thu Nov 11, 2004 8:20 pm
Location: San Jose, CA

Postby phunkphorce on Thu Mar 22, 2007 5:43 am

if a plugin is enabled globally, calling BlogSettings::getValue() will return the global value even if that plugin was never configured for a specific blog. Take a look at how that method has been implemented, probably you'll understand the logic behind it.

With regards to events when a blog is created, that would be possible when the blog is created from the admin interface but it's not possible when created via summary.php because plugins are not integrated with the summary...
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby pwestbro on Thu Mar 22, 2007 5:52 am

phunkphorce wrote:if a plugin is enabled globally, calling BlogSettings::getValue() will return the global value even if that plugin was never configured for a specific blog. Take a look at how that method has been implemented, probably you'll understand the logic behind it.

Sure. I was wondering about being able to call some code in the plugin when the global setting state, for this plugin, changes.
pwestbro
 
Posts: 99
Joined: Thu Nov 11, 2004 8:20 pm
Location: San Jose, CA

Postby phunkphorce on Thu Mar 22, 2007 6:58 am

We can probably add an event that would be triggered when the global plugin settings are updated. I don't think that would be too difficult.
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby pwestbro on Thu Mar 22, 2007 12:27 pm

phunkphorce wrote:We can probably add an event that would be triggered when the global plugin settings are updated. I don't think that would be too difficult.


Thanks. I'll write up a bug.
pwestbro
 
Posts: 99
Joined: Thu Nov 11, 2004 8:20 pm
Location: San Jose, CA


Return to Plugin Development Team

cron