forked from obenland/wp-approve-user
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp-approve-user.php
52 lines (45 loc) · 1.35 KB
/
wp-approve-user.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* Plugin Name: WP Approve User
* Plugin URI: http://en.wp.obenland.it/wp-approve-user/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wp-approve-user
* Description: Adds action links to user table to approve or unapprove user registrations.
* Version: 11
* Author: Konstantin Obenland
* Author URI: http://en.wp.obenland.it/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wp-approve-user
* Text Domain: wp-approve-user
* Domain Path: /lang
* License: GPLv2
*
* @package WP Approve User
*/
if ( ! get_option( 'users_can_register' ) ) {
require_once 'noop.php';
return;
}
if ( ! class_exists( 'Obenland_Wp_Plugins_V5' ) ) {
require_once 'class-obenland-wp-plugins-v5.php';
}
require_once 'class-obenland-wp-approve-user.php';
/**
* Instantiates Obenland_Wp_Approve_User.
*/
function wp_approve_user_instantiate() {
Obenland_Wp_Approve_User::get_instance();
}
add_action( 'plugins_loaded', 'wp_approve_user_instantiate', 0 );
/**
* Approves all existing users.
*/
function wp_approve_user_activate() {
$user_ids = get_users(
array(
'blog_id' => '',
'fields' => 'ID',
)
);
foreach ( $user_ids as $user_id ) {
add_user_meta( $user_id, 'wp-approve-user', true, true );
add_user_meta( $user_id, 'wp-approve-user-mail-sent', true, true );
}
}
register_activation_hook( __FILE__, 'wp_approve_user_activate' );