Page 1 of 1

Activating a WP Plugin during install?

Posted: Sat Jul 13, 2013 6:04 pm
by timmmmyboy
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.

Re: Activating a WP Plugin during install?

Posted: Mon Jul 15, 2013 6:40 am
by Josh
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

Re: Activating a WP Plugin during install?

Posted: Tue Jul 16, 2013 9:48 pm
by timmmmyboy
Awesome, thanks for the tip!