function fts_plugin_version_check() { // return error if no data retreived try { $update_msg = 'Please update ALL Premium Extensions for Feed Them Social because they will no longer work with this version of Feed Them Social. We have made some Major Changes to the Core of the plugin to help with plugin conflicts. Please update your extensions from your <a href="http://www.slickremix.com/my-account" target="_blank">My Account</a> page on our website if you are not receiving notifications for updates on the premium extensions. Thanks again for using our plugin!'; $list_old_plugins = array('feed-them-premium/feed-them-premium.php', 'fts-bar/fts-bar.php', 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php'); $plugins = get_plugins(); foreach ($list_old_plugins as $single_plugin) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; if (isset($plugins[$single_plugin])) { $fts_versions_needed = \fts_versions_needed(); if ($plugins[$single_plugin]['Version'] < $fts_versions_needed[$single_plugin] && is_plugin_active($single_plugin)) { //Don't Let Old Plugins Activate throw new \Exception('<div class="fts-update-message fts_old_plugins_message">' . $update_msg . '</div>'); deactivate_plugins($single_plugin); } } } } catch (\Exception $e) { add_action('admin_notices', function () use($e) { echo $e->getMessage(); }); return true; } }
function fts_old_extenstions_block() { global $current_user; $user_id = $current_user->ID; $list_old_plugins = array('feed-them-premium/feed-them-premium.php', 'fts-bar/fts-bar.php', 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php'); $plugins = get_plugins(); foreach ($list_old_plugins as $single_plugin) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; if (isset($plugins[$single_plugin])) { $fts_versions_needed = \fts_versions_needed(); if ($plugins[$single_plugin]['Version'] < $fts_versions_needed[$single_plugin] && is_plugin_active($single_plugin)) { //Don't Let Old Plugins Activate deactivate_plugins($single_plugin); if (isset($_GET['activate'])) { delete_user_meta($user_id, 'fts_old_plugins_ignore'); unset($_GET['activate']); } } elseif ($plugins[$single_plugin]['Version'] >= $fts_versions_needed[$single_plugin] && is_plugin_active($single_plugin)) { global $current_user; $is_an_admin = in_array('administrator', $current_user->roles); $user_id = $current_user->ID; /* If user clicks to ignore the notice, add that to their user meta */ if (isset($_GET['fts_old_plugins_ignore']) && '0' == $_GET['fts_old_plugins_ignore'] && $is_an_admin == true) { add_user_meta($user_id, 'fts_old_plugins_ignore', 'true', true); //delete_user_meta( $user_id, 'das_old_plugins_ignore'); } } } } }