Activating a WP Plugin during install?

SDK Docs: http://installatron.com/developer/apps
SDK GUI Editor: http://installatron.com/editor
Post Reply
timmmmyboy
Posts: 5
Joined: Mon Mar 25, 2013 10:23 am

Activating a WP Plugin during install?

Post by timmmmyboy » Sat Jul 13, 2013 6:04 pm

Adding plugins seems to be pretty straightforward with the documentation but is there any way to have a plugin be activated by default? I'm guessing it probably means writing a modification to the database to adjust the table that controls active plugins but didn't know if there was an easier way. We're looking at trying to include a comment spam plugin like Cookies for Comments and have it be on by default. Any way to install and activate it on all existing WP installs would be good too.

Josh
Staff
Posts: 131
Joined: Wed Jul 07, 2010 3:53 pm
Location: USA

Re: Activating a WP Plugin during install?

Post by Josh » Mon Jul 15, 2013 6:40 am

Greetings,

Currently the only way to do this is to write a customization that adds the plugin to WP's activated plugin list. Here's a brief example which can be included into your existing customization code:

Code: Select all

$o->db_query("UPDATE `{$o->db_prefix}options` SET `option_value`=? WHERE `option_name`='active_plugins' LIMIT 1",array( serialize(array("plugin1","plugin2","etc")) )); 
If there are any questions let us know.

Best regards,
Josh

timmmmyboy
Posts: 5
Joined: Mon Mar 25, 2013 10:23 am

Re: Activating a WP Plugin during install?

Post by timmmmyboy » Tue Jul 16, 2013 9:48 pm

Awesome, thanks for the tip!

Post Reply