/** * [delete_all description] * @return [type] [description] */ public static function delete_all() { //at first delete all CBRatingSystemData::delete_tables(); CBRatingSystemData::delete_options(); CBRatingSystemData::delete_metakeys(); //now build all again //self::build_admin_ratingForm_tool_settings(); }
/** * called when plugin uninstalled/delete * delete all options if delete all saved from tools page */ public static function cbratingsystem_uninstall() { if (!current_user_can('activate_plugins')) { return; } check_admin_referer('bulk-plugins'); // Important: Check if the file is the one // that was registered during the uninstall hook. if (__FILE__ != WP_UNINSTALL_PLUGIN) { return; } # Uncomment the following line to see the function in action # exit( var_dump( $_GET ) ); $checkuninstall = intval(get_option('cbratingsystem_deleteonuninstall')); if ($checkuninstall == 1) { CBRatingSystemData::delete_tables(); CBRatingSystemData::delete_options(); CBRatingSystemData::delete_metakeys(); } }
<?php /** * Fired when the plugin is uninstalled. * * @package rating * @author codeboxr <*****@*****.**> * @license GPL-2.0+ * @link http://codeboxr.com * @copyright 2014 codeboxr */ // If uninstall not called from WordPress, then exit require_once plugin_dir_path(__FILE__) . "data.php"; if (!defined('WP_UNINSTALL_PLUGIN')) { exit; } if (!current_user_can('activate_plugins')) { return; } check_admin_referer('bulk-plugins'); //var_dump(current_user_can( 'activate_plugins' ));exit; // Important: Check if the file is the one // that was registered during the uninstall hook. $checkuninstall = intval(get_option('cbratingsystem_deleteonuninstall')); if ($checkuninstall == 1) { CBRatingSystemData::delete_tables(); CBRatingSystemData::delete_options(); CBRatingSystemData::delete_metakeys(); }