/**

* check_dependent_plugin_is_activated_or_not
**/
include_once(ABSPATH . 'wp-admin/includes/plugin.php');

add_action('plugins_loaded', 'wpge_dependent_plugin_is_activated');

function wpge_dependent_plugin_is_activated()
{
$wp_graphql = 'wp-graphql/wp-graphql.php';


$wp_graphql_jwt_authentication = 'wp-graphql-jwt-authentication/wp-graphql-jwt-authentication.php';

if (!is_plugin_active($wp_graphql)) {

# Deactivate the current plugin
deactivate_plugins(plugin_basename(__FILE__));

# Show an error alert on the admin area
add_action('admin_notices', function () {
echo '<div class="updated error"><p>';
echo __('The plugin <strong>WPGraphQL JWT Authentication Extended</strong> needs the plugin <strong>WPGraphQL JWT Authentication</strong> to be active', '');
echo '<br>';
echo __('<strong>WPGraphQL JWT Authentication Extended</strong> has been deactivated', '');
echo '</p></div>';
if (isset($_GET['activate']))
unset($_GET['activate']);
});
}
}