1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace BulkWP\BulkDelete\Core\Users; |
4
|
|
|
|
5
|
|
|
use BulkWP\BulkDelete\Core\Base\BaseDeletePage; |
6
|
|
|
|
7
|
|
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly. |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Bulk Delete Users Page. |
11
|
|
|
* |
12
|
|
|
* Shows the list of modules that provides the ability to delete users. |
13
|
|
|
* |
14
|
|
|
* @since 5.5 |
15
|
|
|
* @since 6.0.0 Renamed to DeleteUsersPage |
16
|
|
|
*/ |
17
|
|
|
class DeleteUsersPage extends BaseDeletePage { |
18
|
|
|
/** |
19
|
|
|
* Initialize and setup variables. |
20
|
|
|
* |
21
|
|
|
* @since 5.5 |
22
|
|
|
*/ |
23
|
|
|
protected function initialize() { |
24
|
|
|
if ( is_multisite() ) { |
25
|
|
|
$this->multisite_init(); |
26
|
|
|
} else { |
27
|
|
|
$this->single_site_init(); |
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Initialises several page level variables for multisite(subsites). |
33
|
|
|
* |
34
|
|
|
* @return void |
35
|
|
|
*/ |
36
|
|
|
protected function multisite_init() { |
37
|
|
|
$this->page_slug = 'bulk-remove-users'; |
38
|
|
|
$this->item_type = 'users'; |
39
|
|
|
|
40
|
|
|
$this->label = array( |
41
|
|
|
'page_title' => __( 'Bulk Remove Users', 'bulk-delete' ), |
42
|
|
|
'menu_title' => __( 'Bulk Remove Users', 'bulk-delete' ), |
43
|
|
|
); |
44
|
|
|
|
45
|
|
|
$this->messages = array( |
46
|
|
|
'warning_message' => esc_html__( 'WARNING: Users will be only removed from the subsite. If the users should be deleted, then link them to the page at ', 'bulk-delete' ) . '<a href="'. $PLUGIN_ROOT . 'network">network level</a>.', |
|
|
|
|
47
|
|
|
); |
48
|
|
|
|
49
|
|
|
$this->show_link_in_plugin_list = true; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Initialises several page level variables for single site. |
54
|
|
|
* |
55
|
|
|
* @return void |
56
|
|
|
*/ |
57
|
|
|
protected function single_site_init() { |
58
|
|
|
$this->page_slug = 'bulk-delete-users'; |
59
|
|
|
$this->item_type = 'users'; |
60
|
|
|
|
61
|
|
|
$this->label = array( |
62
|
|
|
'page_title' => __( 'Bulk Delete Users', 'bulk-delete' ), |
63
|
|
|
'menu_title' => __( 'Bulk Delete Users', 'bulk-delete' ), |
64
|
|
|
); |
65
|
|
|
|
66
|
|
|
$this->messages = array( |
67
|
|
|
'warning_message' => esc_html__( 'WARNING: Users deleted once cannot be retrieved back. Use with caution.', 'bulk-delete' ), |
68
|
|
|
); |
69
|
|
|
|
70
|
|
|
$this->show_link_in_plugin_list = true; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Render page header. |
75
|
|
|
*/ |
76
|
|
|
protected function render_header() { |
77
|
|
|
if ( empty( $this->messages['warning_message'] ) ) { |
78
|
|
|
return; |
79
|
|
|
} |
80
|
|
|
?> |
81
|
|
|
<div class="notice notice-warning"> |
82
|
|
|
<p> |
83
|
|
|
<strong> |
84
|
|
|
<?php echo ( $this->messages['warning_message'] ); ?> |
85
|
|
|
</strong> |
86
|
|
|
</p> |
87
|
|
|
</div> |
88
|
|
|
<?php |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Add Help tabs. |
93
|
|
|
* |
94
|
|
|
* @since 5.5 |
95
|
|
|
* |
96
|
|
|
* @param array $help_tabs List of help tabs. |
97
|
|
|
* |
98
|
|
|
* @return array Modified list of help tabs. |
99
|
|
|
*/ |
100
|
|
|
protected function add_help_tab( $help_tabs ) { |
101
|
|
|
$overview_tab = array( |
102
|
|
|
'title' => __( 'Overview', 'bulk-delete' ), |
103
|
|
|
'id' => 'overview_tab', |
104
|
|
|
'content' => '<p>' . __( 'This screen contains different modules that allows you to delete users or schedule them for deletion.', 'bulk-delete' ) . '</p>', |
105
|
|
|
'callback' => false, |
106
|
|
|
); |
107
|
|
|
|
108
|
|
|
$help_tabs['overview_tab'] = $overview_tab; |
109
|
|
|
|
110
|
|
|
return $help_tabs; |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|