Commit ea352a89 authored by KR Moorhouse's avatar KR Moorhouse

Merge branch 'sendwp/sdk#4-already-installed-check' into 'develop'

Check if SendWP is already installed.

See merge request !3839
parents e061ca2e fbcbc71e
Pipeline #2726 passed with stages
in 5 minutes and 44 seconds
......@@ -3,6 +3,18 @@
add_action( 'wp_ajax_ninja_forms_sendwp_remote_install', 'wp_ajax_ninja_forms_sendwp_remote_install_handler' );
function wp_ajax_ninja_forms_sendwp_remote_install_handler () {
$all_plugins = get_plugins();
$is_sendwp_installed = false;
foreach(get_plugins() as $path => $details ) {
if(false === strpos($path, '/sendwp.php')) continue;
$is_sendwp_installed = true;
activate_plugin( $path );
break;
}
if( ! $is_sendwp_installed ) {
$plugin_slug = 'sendwp';
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
......@@ -38,6 +50,8 @@ function wp_ajax_ninja_forms_sendwp_remote_install_handler () {
*/
$activated = activate_plugin( $upgrader->plugin_info() );
}
/*
* Final check to see if SendWP is available.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment