PluginProbe
Leyka / 3.5
Leyka v3.5
3.32.3 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.6.1 2.3.7 2.3.8 2.3.9 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1 3.10 3.11 3.11.1 3.12 3.13 3.14 3.15 3.16 3.17 All 89 releases
leyka / uninstall.php

uninstall.php in Leyka 3.5, at uninstall.php

41 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if( !defined('WP_UNINSTALL_PLUGIN') ) exit; // if uninstall.php is not called by WordPress, die
2 /**
3 * Fired when the plugin is uninstalled.
4 */
5
6 if(get_option('leyka_delete_plugin_data')) { // Completely remove all campaigns & donations data
7
8 global $wpdb;
9
10 $leyka_posts_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->prefix}posts WHERE post_type='leyka_campaign' OR post_type='leyka_donation'");
11 foreach($leyka_posts_ids as $id) {
12 wp_delete_post($id, true); // All revisions, post metas and comments will also be deleted
13 }
14
15 $success_page = get_post(get_option('leyka_success_page'));
16 if(stristr($success_page->post_name, 'thank-you-for-your-donation') !== false) {
17 wp_delete_post($success_page->ID, true);
18 }
19
20 $failure_page = get_post(get_option('leyka_failure_page'));
21 if(stristr($failure_page->post_name, 'sorry-donation-failure') !== false) {
22 wp_delete_post($failure_page->ID, true);
23 }
24
25 $pd_terms_page = get_post(get_option('leyka_pd_terms_page'));
26 if(stristr($pd_terms_page->post_name, 'personal-data-usage-terms') !== false) {
27 wp_delete_post($pd_terms_page->ID, true);
28 }
29
30 }
31
32 if(get_option('leyka_delete_plugin_options')) {
33 foreach(wp_load_alloptions() as $option => $value) {
34 if(stristr($option, 'leyka_') !== false) {
35 delete_option($option);
36 }
37 }
38 }
39
40 remove_role('donations_manager');
41 remove_role('donations_administrator');