- fixed dependencies with extensions, which installed with wrong folder name;

- added notice when UM is installed with wrong folder name;
This commit is contained in:
nikitozzzzzzz
2017-10-18 15:45:59 +03:00
parent 29dccf9f7b
commit 5d14060aff
2 changed files with 31 additions and 0 deletions
+20
View File
@@ -14,10 +14,30 @@ if ( ! class_exists( 'Admin' ) ) {
add_action( 'admin_init', array( &$this, 'admin_init' ), 0 );
add_action( 'admin_notices', array( $this, 'check_wrong_install_folder' ), 3 );
}
function check_wrong_install_folder() {
$invalid_folder = false;
$slug_array = explode( '/', um_plugin );
if ( $slug_array[0] != 'ultimate-member' )
$invalid_folder = true;
if ( $invalid_folder ) { ?>
<div class="error">
<p>
<?php printf( __( 'You have installed <strong>%s</strong> with wrong folder name. Correct folder name is <strong>"ultimate-member"</strong>.', 'ultimate-member' ), ultimatemember_plugin_name ) ?>
</p>
</div>
<?php }
}
/**
+11
View File
@@ -139,6 +139,17 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
}
return $message;
} else {
//check correct folder name for extensions
if ( ! self::$active_plugins ) self::init();
if ( ! in_array( "um-{$ext_key}/um-{$ext_key}.php", self::$active_plugins ) && ! array_key_exists( "um-{$ext_key}/um-{$ext_key}.php", self::$active_plugins ) ) {
$message = sprintf( __( 'Please check <strong>"%s" %s</strong> extension\'s folder name.', 'ultimate-member' ), $ext_title, $ext_ver ) .
'<br />' .
sprintf( __( 'Correct folder name is <strong>"%s"</strong>', 'ultimate-member' ), "um-{$ext_key}" );
return $message;
}
}
return true;