Function Reference: geodir_location_uninstall
Summary
Function to delete all the location adons related data and option on plugin deletion.
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
- $plugin_prefix
- (string) (required) Geodirectory plugin table prefix.
- Default: None
Package
GeoDirectory_Location_Manager
Change Log
Since: 1.0.0
Source File
geodir_location_uninstall() is located in geodir_location_manager/geodir_location_hooks_actions.php [Line: 258]
Source Code
function geodir_location_uninstall() { if ( ! isset($_REQUEST['verify-delete-adon']) ) { $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); //$_POST = from the plugin form; $_GET = from the FTP details screen. wp_enqueue_script('jquery'); require_once(ABSPATH . 'wp-admin/admin-header.php'); printf( 'get_results( $wpdb->prepare( "SELECT post_id from ".$table." where post_location_id != %d", array($default_location->location_id) ) ); if(!empty($del_post_sql)){ foreach($del_post_sql as $del_post_info) { $postid = $del_post_info->post_id; wp_delete_post($postid); } } $wpdb->query("UPDATE ".$table." SET post_location_id='0'"); if($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = 'post_neighbourhood'")) $wpdb->query("ALTER TABLE ".$table." DROP post_neighbourhood"); } } $wpdb->query("DROP TABLE ".$plugin_prefix."post_locations"); $wpdb->query("DROP TABLE ".$plugin_prefix."post_neighbourhood"); $wpdb->query("DROP TABLE IF EXISTS ".$plugin_prefix."location_seo"); $default_location->location_id = 0; update_option('geodir_default_location', $default_location); } }%s
' ,__( 'Warning!!' , GEODIRLOCATION_TEXTDOMAIN) ); printf( '%s
%s
%s %s.' , __('You are about to delete a Geodirectory Adon which has important option and custom data associated to it.' ,GEODIRLOCATION_TEXTDOMAIN) ,__('Deleting this and activating another version, will be treated as a new installation of plugin, so all the data will be lost.', GEODIRLOCATION_TEXTDOMAIN), __('If you have any problem in upgrading the plugin please contact Geodirectroy', GEODIRLOCATION_TEXTDOMAIN) , __('support' ,GEODIRLOCATION_TEXTDOMAIN) ) ; ?>