forked from wp-plugins/comment-attachment
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
23 lines (21 loc) · 696 Bytes
/
uninstall.php
File metadata and controls
23 lines (21 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
//if uninstall not called from WordPress exit
if (!defined('WP_UNINSTALL_PLUGIN'))
exit();
$optionName = 'commentAttachment';
// For Single site
if (!is_multisite()){
delete_option($optionName);
foreach (get_users('fields=ID') as $userId){
delete_user_meta($userId, 'wpCommentAttachmentIgnoreNag'); // remove the nag notice, clean after us
}
} else {
global $wpdb;
$blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
$original_blog_id = get_current_blog_id();
foreach ($blog_ids as $blog_id){
switch_to_blog($blog_id);
delete_site_option($optionName);
}
switch_to_blog($original_blog_id);
}