script to activate wp plugins

enderz

New member
Jan 13, 2009
727
2
0
Hi,

Im searching for a php script that will automatically activate my wp plugins. I would write one if I new how.

I saw that in the option table it is set if a plugins is activated and all its parameters, so I can update those records, but I guess it is not enough , I guess some of the plugins create tables or stuff like that when they are activated.

Is there a way to activate a plugins through an extrenal php script???
 


You could use curl to sign in to WP admin page. Then use curl to send your activation command: hxxp://yousite.com/wp-admin/plugins.php?action=activate&plugin=akismet%2Fakismet.php&plugin_status=all&paged=1 or whatever it is for that plugin. That way WP still handles the activation.
 
You can do it by modifying the install.php file in WP. It's simple enough, and is the recommended way to do it.

The problem is finding all the options set by the plugin so you can insert those entries into the db once you've activated it, or you're still in a position where, although you've activated the plugin, you still need to configure it.

Essentially, for each plugin you want auto activated, you're going to have to run the activate and configure manually into a clean install of WP so you can find all the touchpoints to do your own routine that's handled by your install.php. The way I do it is to have a reference db with a clean, untouched install of WP, and the install and activate a plugin and do a db-diff to find out what's inserted where and then convert that into something install.php can insert.
 
Thx. Thiis is what I did (db wise), but it just set the options, how do I actually activate the plugins??
 
WordPress has a function called activate_plugins. You pass it a plugin root file or an array thereof and it activates them. Use this to your advantage.

Edit: doing it directly won't call each plugin's activate hook. bad bad bad.
 
sound gr8...

WordPress has a function called activate_plugins. You pass it a plugin root file or an array thereof and it activates them. Use this to your advantage.

Edit: doing it directly won't call each plugin's activate hook. bad bad bad.

Yeap!! thats what i was looking for, thx a million :)

Btw, what do u mean by activating directly??
 
activate_plugins won't work.

I'm busy coding an app that does just this, btw.

I've got the auto_activate_plugins written, and am working on adding support for plugin options as an advanced feature at the moment.

If you're interested in a private beta, let me know.
I'll be releasing this as a commercial product within the next 2 months or so.
 
Kiwi I sure am interested and I can be a very good beta tester, cause Im a coder myself :)
 
You can activate the plugin automatically, but the configuration for each plugin will be different. For this, you need to understand each plugin separately and write code for it.
 
Bahhhhh

You can activate the plugin automatically, but the configuration for each plugin will be different. For this, you need to understand each plugin separately and write code for it.

i don't care about the fucking configuration, just want to succeed in activating the fucking plugin...

Who is the king that can paste a sample here that will auto activate some plugin???????????
 
RapidShare: 1-CLICK Web hosting - Easy Filehosting

It's a beta version of the script I'm busy with, encoded because I don't want to release publicly yet.

Replace the existing plugin.php in wp-admin/includes/ with the ioncubed version, then in wp-admin/install.php, add this to the file:
require_once('./includes/plugin.php');

For each plugin you want to call, you use this:
auto_activate_plugin(WP_PLUGIN_DIR.'/DIRECTORYWITHPLUGIN/MAINPLUGINFILE.php');

Note that MAINPLUGINFILE is different for each plugin, so you have to know which file is used when you use the regular activate_plugin WP function.
So, for example, if you wanted to auto activate akismet, you would use:

auto_activate_plugin(WP_PLUGIN_DIR.'/akismet/akismet.php');

PM me if you want to discuss further.