1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Bulk Delete Users Page. |
4
|
|
|
* Shows the list of modules that allows you to delete users. |
5
|
|
|
* |
6
|
|
|
* @since 5.5 |
7
|
|
|
* |
8
|
|
|
* @author Sudar |
9
|
|
|
* |
10
|
|
|
* @package BulkDelete\Users |
11
|
|
|
*/ |
12
|
|
|
defined( 'ABSPATH' ) || exit; // Exit if accessed directly |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Delete Users Page. |
16
|
|
|
* |
17
|
|
|
* @since 5.5 |
18
|
|
|
*/ |
19
|
|
|
class BD_Users_Page extends BD_Page { |
20
|
|
|
/** |
21
|
|
|
* Make this class a "hybrid Singleton". |
22
|
|
|
* |
23
|
|
|
* @static |
24
|
|
|
* |
25
|
|
|
* @since 5.5 |
26
|
|
|
*/ |
27
|
1 |
|
public static function factory() { |
28
|
1 |
|
static $instance = false; |
29
|
|
|
|
30
|
1 |
|
if ( ! $instance ) { |
31
|
1 |
|
$instance = new self; |
32
|
|
|
} |
33
|
|
|
|
34
|
1 |
|
return $instance; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Initialize and setup variables. |
39
|
|
|
* |
40
|
|
|
* @since 5.5 |
41
|
|
|
*/ |
42
|
1 |
|
protected function initialize() { |
43
|
1 |
|
$this->page_slug = 'bulk-delete-users'; |
44
|
1 |
|
$this->item_type = 'users'; |
45
|
1 |
|
$this->capability = 'delete_users'; |
46
|
|
|
|
47
|
1 |
|
$this->label = array( |
48
|
1 |
|
'page_title' => __( 'Bulk Delete Users', 'bulk-delete' ), |
49
|
1 |
|
'menu_title' => __( 'Bulk Delete Users', 'bulk-delete' ), |
50
|
|
|
); |
51
|
|
|
|
52
|
1 |
|
$this->messages = array( |
53
|
1 |
|
'warning_message' => __( 'WARNING: Users deleted once cannot be retrieved back. Use with caution.', 'bulk-delete' ), |
54
|
|
|
); |
55
|
|
|
|
56
|
1 |
|
add_filter( 'plugin_action_links', array( $this, 'add_plugin_action_links' ), 10, 2 ); |
57
|
1 |
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Adds setting links in plugin listing page. |
61
|
|
|
* Based on http://striderweb.com/nerdaphernalia/2008/06/wp-use-action-links/. |
62
|
|
|
* |
63
|
|
|
* @param array $links List of current links |
64
|
|
|
* @param string $file Plugin filename |
65
|
|
|
* |
66
|
|
|
* @return array $links Modified list of links |
67
|
|
|
*/ |
68
|
|
|
public function add_plugin_action_links( $links, $file ) { |
69
|
|
|
$this_plugin = plugin_basename( Bulk_Delete::$PLUGIN_FILE ); |
70
|
|
|
|
71
|
|
|
if ( $file == $this_plugin ) { |
72
|
|
|
$delete_users_link = '<a href="admin.php?page=' . $this->page_slug . '">' . __( 'Bulk Delete Users', 'bulk-delete' ) . '</a>'; |
73
|
|
|
array_unshift( $links, $delete_users_link ); // before other links |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
return $links; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Add Help tabs. |
81
|
|
|
* |
82
|
|
|
* @since 5.5 |
83
|
|
|
* |
84
|
|
|
* @param mixed $help_tabs |
85
|
|
|
*/ |
86
|
|
|
protected function add_help_tab( $help_tabs ) { |
87
|
|
|
$overview_tab = array( |
88
|
|
|
'title' => __( 'Overview', 'bulk-delete' ), |
89
|
|
|
'id' => 'overview_tab', |
90
|
|
|
'content' => '<p>' . __( 'This screen contains different modules that allows you to delete users or schedule them for deletion.', 'bulk-delete' ) . '</p>', |
91
|
|
|
'callback' => false, |
92
|
|
|
); |
93
|
|
|
$help_tabs['overview_tab'] = $overview_tab; |
94
|
|
|
|
95
|
|
|
return $help_tabs; |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
BD_Users_Page::factory(); |
100
|
|
|
|