Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Activate BuddyPress components programmatically

@djpaul

Keymaster

@schweizersolutions With your current solution:

1) If BuddyPress is loaded in this context, I’d strongly recommend you use bp_update_option instead of update_option as this supports all the different configurations of BuddyPress install/configuration.

2) If you look at bp_version_updater or bp_core_admin_components_settings_handler for example, it does what you’re doing, but it runs the installation routines afterwards. I’d recommend you copy the logic from bp_core_admin_components_settings_handler.

3) An alternate approach is to filter the bp_new_install_default_components array as long as you can put that in place before BuddyPress loads.

4) I think activated_plugin might be too early, i.e. before BuddyPress installs. I am not sure, I can’t test right now. BuddyPress’ core routines start from plugins_loaded, and I think that’ll have already be triggered before activated_plugin, so the behaviour will be undefined (i.e. it might install on the next page load, or part-install immediately, and I have no idea if this will break stuff).

Hope this helps

Skip to toolbar