Passed
Push — 672-feature/user-removal-in-su... ( 947941 )
by
unknown
05:27
created

DeleteUsersPage::single_site_init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 14
ccs 0
cts 11
cp 0
crap 2
rs 10
c 1
b 0
f 0
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
	protected function multisite_init() {
32
		$this->page_slug = 'bulk-remove-users';
33
		$this->item_type = 'users';
34
35
		$this->label = array(
36
			'page_title' => __( 'Bulk Remove Users', 'bulk-delete' ),
37
			'menu_title' => __( 'Bulk Remove Users', 'bulk-delete' ),
38
		);
39
40
		$this->messages = array(
41
			'warning_message' => __( 'WARNING: Users will be only removed from the subsite. If the users should be deleted, then link them to the page at network level.', 'bulk-delete' ),
42
		);
43
44
		$this->show_link_in_plugin_list = true;
45
	}
46
47
	protected function single_site_init() {
48
		$this->page_slug = 'bulk-delete-users';
49
		$this->item_type = 'users';
50
51
		$this->label = array(
52
			'page_title' => __( 'Bulk Delete Users', 'bulk-delete' ),
53
			'menu_title' => __( 'Bulk Delete Users', 'bulk-delete' ),
54
		);
55
56
		$this->messages = array(
57
			'warning_message' => __( 'WARNING: Users deleted once cannot be retrieved back. Use with caution.', 'bulk-delete' ),
58
		);
59
60
		$this->show_link_in_plugin_list = true;
61
	}
62
63
	/**
64
	 * Add Help tabs.
65
	 *
66
	 * @since 5.5
67
	 *
68
	 * @param array $help_tabs List of help tabs.
69
	 *
70
	 * @return array Modified list of help tabs.
71
	 */
72
	protected function add_help_tab( $help_tabs ) {
73
		$overview_tab = array(
74
			'title'    => __( 'Overview', 'bulk-delete' ),
75
			'id'       => 'overview_tab',
76
			'content'  => '<p>' . __( 'This screen contains different modules that allows you to delete users or schedule them for deletion.', 'bulk-delete' ) . '</p>',
77
			'callback' => false,
78
		);
79
80
		$help_tabs['overview_tab'] = $overview_tab;
81
82
		return $help_tabs;
83
	}
84
}
85