New User Approve - Version 2.0

Version Description

  • Updated- Plugin menu.
  • Added- the invitation code functionality.
  • Improved backend UI.
Download this release

Release Info

Developer wpexpertsio
Plugin Icon 128x128 New User Approve
Version 2.0
Comparing to
See all releases

Code changes from version 1.9.1 to 2.0

assets/css/nua-admin-style.css ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ body.new-users-approve_page_new-user-approve-config, body, body.new-users-approve_page_new-user-approve-auto-approve, body.new-users-approve_page_nua-invitation-code {
3
+ background: #FFF;
4
+ color: #444444;
5
+ }
6
+ #nua-approve-admin {
7
+ border: none;
8
+ }
9
+ #nua-approve-admin .postbox-header{
10
+ border-bottom: none;
11
+ }
12
+
13
+
14
+ #nua-approve-admin .nav-tab, .nav-tab, .new-users-approve_page_new-user-approve-auto-approve .nav-tab, .new-users-approve_page_nua-invitation-code .nav-tab{
15
+ padding: 15px 25px;
16
+ font-size: 14px;
17
+ line-height: 1.7;
18
+ border: none;
19
+ border-radius: 9px;
20
+ background: #fbfbfb;
21
+ border: 1px solid #f3f3f3;
22
+ }
23
+ #nua-approve-admin .nav-tab-active, .nav-tab-active, .new-users-approve_page_new-user-approve-auto-approve .nav-tab-active, .new-users-approve_page_nua-invitation-code .nav-tab-active{
24
+ color:#FFF;
25
+ background: #2c725e;
26
+ }
27
+
28
+ #nua-approve-admin #pw_pending_users, #nua-approve-admin #pw_approved_users, #nua-approve-admin #pw_denied_users {
29
+ margin-top:30px;
30
+ }
31
+
32
+ #pw_pending_users .thead, #pw_approved_users .thead, #pw_denied_users .thead{
33
+ outline: 1px solid #ccd0d4;
34
+ }
35
+
36
+ #pw_pending_users table.widefat thead th, #pw_approved_users table.widefat thead th, #pw_denied_users table.widefat thead th {
37
+ border-bottom: none;
38
+ }
39
+
40
+ #pw_pending_users table.widefat, #pw_approved_users table.widefat, #pw_denied_users table.widefat {
41
+ border: none;
42
+ }
43
+
44
+
45
+ #pw_pending_users .button-primary, #pw_approved_users .button-primary, #pw_denied_users .button-primary {
46
+ background:#61bd4f;
47
+ color:#FFF;
48
+ border-color: #73e831;
49
+ float:right;
50
+ }
51
+
52
+ #pw_denied_users .button-primary {
53
+ float:none;
54
+ }
55
+
56
+ #pw_pending_users .button, #pw_approved_users .button, #pw_denied_users .button {
57
+
58
+ background:#eb5a46;
59
+ color:#FFF;
60
+ border-color: #f3463a;
61
+ }
62
+
63
+ #nua-approve-admin .postbox-header {
64
+ display:none;
65
+ }
66
+
67
+ #pw_pending_users .widefat th:last-child, #pw_approved_users .widefat th:last-child, #pw_denied_users .widefat th:last-child {
68
+ text-align:center;
69
+ }
70
+
71
+ #nua-approve-admin .status_heading{
72
+ font-size:18px;
73
+ }
74
+
75
+
76
+ /* nua settings page start */
77
+ .nua_switch {
78
+ position: relative;
79
+ display: inline-block;
80
+ width: 60px;
81
+ height: 34px;
82
+ }
83
+
84
+ .nua_switch input {
85
+ opacity: 0;
86
+ width: 0;
87
+ height: 0;
88
+ }
89
+
90
+ .nua_slider {
91
+ position: absolute;
92
+ cursor: pointer;
93
+ top: 0;
94
+ left: 0;
95
+ right: 0;
96
+ bottom: 0;
97
+ background-color: #ccc;
98
+ -webkit-transition: .4s;
99
+ transition: .4s;
100
+ }
101
+
102
+ .nua_slider:before {
103
+ position: absolute;
104
+ content: "";
105
+ height: 26px;
106
+ width: 26px;
107
+ left: 4px;
108
+ bottom: 4px;
109
+ background-color: white;
110
+ -webkit-transition: .4s;
111
+ transition: .4s;
112
+ }
113
+
114
+ input:checked + .nua_slider {
115
+ background-color: #2196F3;
116
+ }
117
+
118
+ input:focus + .nua_slider {
119
+ box-shadow: 0 0 1px #2196F3;
120
+ }
121
+
122
+ input:checked + .nua_slider:before {
123
+ -webkit-transform: translateX(26px);
124
+ -ms-transform: translateX(26px);
125
+ transform: translateX(26px);
126
+ }
127
+
128
+ /* Rounded sliders */
129
+ .nua_slider.round {
130
+ border-radius: 34px;
131
+ }
132
+
133
+ .nua_slider.round:before {
134
+ border-radius: 50%;
135
+ }
136
+ .nav-tab-wrapper, .new-users-approve_page_new-user-approve-auto-approve .nav-tab-wrapper, .new-users-approve_page_nua-invitation-code .nav-tab-wrapper{
137
+ border-bottom:none !important;
138
+ }
139
+ .nua-settings-heading {
140
+ margin-bottom:10px;
141
+ }
142
+
143
+ .nua-tags {
144
+ cursor: pointer;
145
+ background-color: #c8daff;
146
+ color: #000;
147
+ padding: 2px;
148
+ margin: 2px;
149
+ display: inline-block;
150
+ }
151
+ /* nua settings page start end*/
152
+
153
+ .nua-textarea {
154
+ width:100%;
155
+ min-height: 200px;
156
+ }
157
+ #nua_options_blacklist_message {
158
+ width:600px;
159
+ }
160
+
161
+ .approve-new-users_page_nua-invitation-code .nav-subtab-wrapper {
162
+ height: 60px;
163
+ }
164
+
165
+ #nua_email_users_email {
166
+ min-height: 100px;
167
+ }
168
+
169
+ #nua-approve-admin .sub_nav-tab-class, .sub_nav-tab-class, .approve-new-users_page_new-user-approve-auto-approve .sub_nav-tab-class, .approve-new-users_page_nua-invitation-code .sub_nav-tab-class{
170
+ padding: 2px;
171
+ font-size: 16px;
172
+ line-height: 1.7;
173
+ color: blue;
174
+ border-left: 1px outset;
175
+ text-decoration: none;
176
+ margin-left: 10px;
177
+ padding-left: 1px;
178
+ border-collapse:collapse;
179
+ padding: 2px 10px 2px 10px;
180
+ }
181
+
182
+
183
+ #nua-approve-admin .sub_nav-tab-class-active, .sub_nav-tab-class-active, .approve-new-users_page_new-user-approve-auto-approve .sub_nav-tab-class-active, .approve-new-users_page_nua-invitation-code .sub_nav-tab-class-active{
184
+ color:#000000;
185
+ }
186
+ .nua_sub_nav a:first-child {
187
+ border: none;
188
+ }
includes/admin-approve.php CHANGED
@@ -48,9 +48,10 @@ class pw_new_user_approve_admin_approve {
48
 
49
  if ( $show_admin_page ) {
50
  $cap = apply_filters( 'new_user_approve_minimum_cap', 'edit_users' );
51
- $hook = add_users_page( __( 'Approve New Users', 'new-user-approve' ), __( 'Approve New Users', 'new-user-approve' ), $cap, $this->_admin_page, array( $this, 'approve_admin' ) );
52
- add_users_page( __( 'Upgrade', 'new-user-approve' ), '  '.__( 'Upgrade', 'new-user-approve' ), $cap, $this->_admin_upgrade_page, array( $this, 'new_user_approve_upgrade' ) );
53
  add_action( 'load-' . $hook, array( $this, 'admin_enqueue_scripts' ) );
 
54
  }
55
  }
56
 
@@ -83,6 +84,19 @@ class pw_new_user_approve_admin_approve {
83
  $users = $user_status[$status];
84
 
85
  if ( count( $users ) > 0 ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  ?>
87
  <table class="widefat">
88
  <thead>
@@ -91,9 +105,9 @@ class pw_new_user_approve_admin_approve {
91
  <th><?php _e( 'Name', 'new-user-approve' ); ?></th>
92
  <th><?php _e( 'E-mail', 'new-user-approve' ); ?></th>
93
  <?php if ( 'pending' == $status ) { ?>
94
- <th colspan="2"><?php _e( 'Actions', 'new-user-approve' ); ?></th>
95
  <?php } else { ?>
96
- <th><?php _e( 'Actions', 'new-user-approve' ); ?></th>
97
  <?php } ?>
98
  </tr>
99
  </thead>
@@ -106,13 +120,15 @@ class pw_new_user_approve_admin_approve {
106
  $avatar = get_avatar( $user->user_email, 32 );
107
 
108
  if ( $approve ) {
109
- $approve_link = get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=approve';
110
  if ( isset( $_REQUEST['tab'] ) )
111
  $approve_link = add_query_arg( array( 'tab' => esc_attr( $_REQUEST['tab'] ) ), $approve_link );
 
112
  $approve_link = wp_nonce_url( $approve_link, 'pw_new_user_approve_action_' . get_class( $this ) );
 
113
  }
114
  if ( $deny ) {
115
- $deny_link = get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=deny';
116
  if ( isset( $_REQUEST['tab'] ) )
117
  $deny_link = add_query_arg( 'tab', esc_attr( $_REQUEST['tab'] ), $deny_link );
118
  $deny_link = wp_nonce_url( $deny_link, 'pw_new_user_approve_action_' . get_class( $this ) );
@@ -190,7 +206,7 @@ class pw_new_user_approve_admin_approve {
190
 
191
  /**
192
  * Display a notice on the legacy page that notifies the user of the new interface.
193
- *
194
  * @uses admin_notices
195
  */
196
  public function admin_notice() {
@@ -234,13 +250,12 @@ class pw_new_user_approve_admin_approve {
234
  $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'pending_users';
235
  ?>
236
  <h3 class="nav-tab-wrapper" style="padding-bottom: 0; border-bottom: none;">
237
- <a href="<?php echo esc_url( admin_url( 'users.php?page=new-user-approve-admin&tab=pending_users' ) ); ?>"
238
- class="nav-tab<?php echo $active_tab == 'pending_users' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Users Pending Approval', 'new-user-approve' ); ?></span></a>
239
- <a href="<?php echo esc_url( admin_url( 'users.php?page=new-user-approve-admin&tab=approved_users' ) ); ?>"
240
  class="nav-tab<?php echo $active_tab == 'approved_users' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Approved Users', 'new-user-approve' ); ?></span></a>
241
- <a href="<?php echo esc_url( admin_url( 'users.php?page=new-user-approve-admin&tab=denied_users' ) ); ?>"
242
- class="nav-tab<?php echo $active_tab == 'denied_users' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Denied Users', 'new-user-approve' ); ?></span></a>
243
- <a href="<?php echo esc_url( admin_url( 'users.php?page=new-user-approve-admin&tab=pro_features' ) ); ?>"
244
  class="nav-tab<?php echo $active_tab == 'pro_features' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Pro Features', 'new-user-approve' ); ?></span></a>
245
  </h3>
246
 
48
 
49
  if ( $show_admin_page ) {
50
  $cap = apply_filters( 'new_user_approve_minimum_cap', 'edit_users' );
51
+ $hook = add_menu_page( __( 'Approve New Users', 'new-user-approve' ), __( 'Approve New Users', 'new-user-approve' ), $cap, $this->_admin_page, array( $this, 'approve_admin' ) );
52
+ add_submenu_page($this->_admin_page,__( 'Upgrade', 'new-user-approve' ),__( 'Upgrade', 'new-user-approve' ),$cap,$this->_admin_upgrade_page,array( $this, 'new_user_approve_upgrade' ));
53
  add_action( 'load-' . $hook, array( $this, 'admin_enqueue_scripts' ) );
54
+
55
  }
56
  }
57
 
84
  $users = $user_status[$status];
85
 
86
  if ( count( $users ) > 0 ) {
87
+ if ( 'denied' == $status ) {
88
+ ?>
89
+ <p class="status_heading"><?php _e( 'Denied Users', 'new-user-approve' ); ?></p>
90
+ <?php
91
+ } else if ( 'approved' == $status ) {
92
+ ?>
93
+ <p class="status_heading"><?php _e( 'Approved Users', 'new-user-approve' ); ?></p>
94
+ <?php
95
+ } else if ( 'pending' == $status ) {
96
+ ?>
97
+ <p class="status_heading"><?php _e( 'Pending Users', 'new-user-approve' ); ?></p>
98
+ <?php
99
+ }
100
  ?>
101
  <table class="widefat">
102
  <thead>
105
  <th><?php _e( 'Name', 'new-user-approve' ); ?></th>
106
  <th><?php _e( 'E-mail', 'new-user-approve' ); ?></th>
107
  <?php if ( 'pending' == $status ) { ?>
108
+ <th colspan="2"><?php _e( 'Action', 'new-user-approve' ); ?></th>
109
  <?php } else { ?>
110
+ <th><?php _e( 'Action', 'new-user-approve' ); ?></th>
111
  <?php } ?>
112
  </tr>
113
  </thead>
120
  $avatar = get_avatar( $user->user_email, 32 );
121
 
122
  if ( $approve ) {
123
+ $approve_link = get_option( 'siteurl' ) . '/wp-admin/admin.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=approve';
124
  if ( isset( $_REQUEST['tab'] ) )
125
  $approve_link = add_query_arg( array( 'tab' => esc_attr( $_REQUEST['tab'] ) ), $approve_link );
126
+
127
  $approve_link = wp_nonce_url( $approve_link, 'pw_new_user_approve_action_' . get_class( $this ) );
128
+
129
  }
130
  if ( $deny ) {
131
+ $deny_link = get_option( 'siteurl' ) . '/wp-admin/admin.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=deny';
132
  if ( isset( $_REQUEST['tab'] ) )
133
  $deny_link = add_query_arg( 'tab', esc_attr( $_REQUEST['tab'] ), $deny_link );
134
  $deny_link = wp_nonce_url( $deny_link, 'pw_new_user_approve_action_' . get_class( $this ) );
206
 
207
  /**
208
  * Display a notice on the legacy page that notifies the user of the new interface.
209
+ *
210
  * @uses admin_notices
211
  */
212
  public function admin_notice() {
250
  $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'pending_users';
251
  ?>
252
  <h3 class="nav-tab-wrapper" style="padding-bottom: 0; border-bottom: none;">
253
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=new-user-approve-admin&tab=pending_users' ) ); ?>"
254
+ class="nav-tab<?php echo $active_tab == 'pending_users' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Pending Users', 'new-user-approve' ); ?></span></a>
255
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=new-user-approve-admin&tab=approved_users' ) ); ?>"
256
  class="nav-tab<?php echo $active_tab == 'approved_users' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Approved Users', 'new-user-approve' ); ?></span></a>
257
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=new-user-approve-admin&tab=denied_users' ) ); ?>"
258
+ class="nav-tab<?php echo $active_tab == 'denied_users' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Denied Users', 'new-user-approve' ); ?></span></a><a href="<?php echo esc_url( admin_url( 'admin.php?page=new-user-approve-admin&tab=pro_features' ) ); ?>"
 
259
  class="nav-tab<?php echo $active_tab == 'pro_features' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Pro Features', 'new-user-approve' ); ?></span></a>
260
  </h3>
261
 
includes/invitation-code.php ADDED
@@ -0,0 +1,635 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** Copyright 2013
4
+ * This program is free software; you can redistribute it and/or modify
5
+ * it under the terms of the GNU General Public License as published by
6
+ * the Free Software Foundation; either version 2 of the License, or
7
+ * (at your option) any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+
20
+ class nua_invitation_code {
21
+
22
+ private static $instance;
23
+
24
+ private $screen_name = 'nua-invitation-code';
25
+ public $code_post_type = 'invitation_code';
26
+ public $usage_limit_key = '_nua_usage_limit';
27
+ public $expiry_date_key = '_nua_code_expiry';
28
+ public $status_key = '_nua_code_status';
29
+ public $code_key = '_nua_code';
30
+ public $total_code_key = '_total_nua_code';
31
+ public $registered_users = '_registered_users';
32
+ private $option_group = 'nua_options_group';
33
+ public $option_key = 'nua_options';
34
+ /**
35
+ * Returns the main instance.
36
+ *
37
+ * @return nua_invitation_code
38
+ */
39
+ public static function instance() {
40
+ if ( !isset( self::$instance ) ) {
41
+ self::$instance = new nua_invitation_code();
42
+ }
43
+ return self::$instance;
44
+ }
45
+
46
+ private function __construct() {
47
+ //Action
48
+ add_action( 'admin_menu', array( $this, 'admin_menu_link' ),30 );
49
+ add_action( 'admin_init', array( $this, 'nua_deactivate_code' ) );
50
+ add_action( 'init', array($this, 'nua_invitation' ));
51
+ add_action( 'add_meta_boxes_'.$this->code_post_type, array($this, 'add_invitation_meta'));
52
+ add_action( 'save_post_'.$this->code_post_type, array($this, 'save_nua_invitation'));
53
+
54
+
55
+ //Filter
56
+ add_filter( 'manage_'.$this->code_post_type.'_posts_columns', array($this,'invitation_code_columns') );
57
+ add_action( 'manage_'.$this->code_post_type.'_posts_custom_column', array($this,'invitation_code_columns_content'), 10, 2);
58
+ add_filter( 'post_row_actions', array($this,'remove_row_actions_from_table'), 10, 2 );
59
+ add_action( 'admin_head', array($this,'invitation_code_edit_page_css') );
60
+
61
+
62
+ $options = get_option( 'nua_free_invitation' );
63
+ if ($options == 'enable'){
64
+ add_action( 'register_form', array($this,'nua_invitation_code_field'));
65
+ add_filter( 'new_user_approve_default_status',array($this,'nua_invitation_status_code') , 10, 2 );
66
+ add_action( 'woocommerce_register_form', array($this,'nua_invitation_code_field'));
67
+ add_action('um_after_form_fields', array($this,'nua_invitation_code_field'), 10, 2 );
68
+ }
69
+ }
70
+
71
+ public function nua_deactivate_code() {
72
+
73
+ if (isset($_GET['post_type']) && $_GET['post_type'] == $this->code_post_type && is_admin()) {
74
+ if (isset($_GET['post_id']) && check_admin_referer( 'nua_deactivate-'.absint($_GET['post_id']), 'nonce' )) {
75
+ update_post_meta (absint($_GET['post_id']), $this->status_key, 'InActive' );
76
+ }
77
+ }
78
+ }
79
+
80
+ public function invitation_code_edit_page_css() {
81
+ if (isset($_GET['post_type']) && $_GET['post_type'] == $this->code_post_type) {
82
+ ?>
83
+ <style>
84
+ .widefat td, .widefat th {
85
+ height: 36px;
86
+ }
87
+ </style>
88
+ <?php
89
+
90
+ }
91
+ }
92
+
93
+ public function remove_row_actions_from_table( $actions, $post ){
94
+ if ($post->post_type == $this->code_post_type){
95
+
96
+ return array();
97
+
98
+ }
99
+ return $actions;
100
+ }
101
+
102
+ /**
103
+ * Add the link to the admin menu for the settings page
104
+ */
105
+ public function admin_menu_link() {
106
+ // don't show the link in the admin menu if the parent plugin is inactive
107
+ if ( !function_exists( 'pw_new_user_approve' ) ) {
108
+ return;
109
+ }
110
+
111
+ $hook = add_submenu_page( 'new-user-approve-admin', __( 'Invitation Code', 'new-user-approve-options' ), __( 'Invitation Code', 'new-user-approve-options' ), 'manage_options', $this->screen_name, array( $this, 'invitation_code_settings' ),2 );
112
+
113
+ add_submenu_page('new-user-approve-admin', __('All Codes', 'woosl'), __('All Codes', 'woosl'), 'manage_options', 'edit.php?post_type=' . $this->code_post_type);
114
+
115
+ add_action( 'admin_print_scripts-' . $hook, array( $this, 'admin_scripts' ) );
116
+ }
117
+
118
+ public function admin_scripts() {
119
+ wp_enqueue_script( 'nua-options' );
120
+ }
121
+
122
+
123
+ /**
124
+ * Post Registration
125
+ */
126
+ public function nua_invitation(){
127
+
128
+ $labels = array(
129
+ 'name' => __( 'Invitation Code', 'new-user-approve-options' ),
130
+ 'singular_name' => __( 'Invitation Code', 'new-user-approve-options' ),
131
+ 'menu_name' => __( 'All Codes', 'new-user-approve-options' ),
132
+ 'name_admin_bar' => __( 'All Codes', 'new-user-approve-options' ),
133
+ 'add_new' => __( 'Add New', 'new-user-approve-options' ),
134
+ 'add_new_item' => __( 'Add New Invitation Code', 'new-user-approve-options' ),
135
+ 'new_item' => __( 'New Invitation Code', 'new-user-approve-options' ),
136
+ 'edit_item' => __( 'Edit Invitation Code', 'new-user-approve-options' ),
137
+ 'view_item' => __( 'View Invitation Code', 'new-user-approve-options' ),
138
+ 'all_items' => __( 'All Invitation Code', 'new-user-approve-options' ),
139
+ );
140
+
141
+ $args = array(
142
+ 'labels' => $labels,
143
+ 'description' => false,
144
+ 'public' => false ,
145
+ 'show_ui' => true,
146
+ 'show_in_menu' => false,
147
+ 'query_var' => false,
148
+ 'rewrite' => false,
149
+ 'capability_type' => 'post',
150
+ 'has_archive' => false,
151
+ 'hierarchical' => false,
152
+ 'menu_position' => null,
153
+ 'menu_icon' => "",
154
+ 'supports' => array( 'title')
155
+ );
156
+
157
+ register_post_type( $this->code_post_type, $args );
158
+
159
+ }
160
+
161
+ /**
162
+ * Output the settings
163
+ */
164
+ public function invitation_code_settings() {
165
+ $action = ( isset( $_GET['action'] ) ) ? $_GET['action'] : 'add-codes';
166
+
167
+ ?>
168
+ <div class="wrap">
169
+ <div id="icon-options-general" class="icon32"><br/></div>
170
+ <h2 class="nua-settings-heading"><?php _e( 'Invitation Code Settings', 'new-user-approve-options' ); ?></h2>
171
+
172
+ <h2 class="nav-tab-wrapper">
173
+ <a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->screen_name ), admin_url( 'admin.php' ) ) ); ?>" class="nav-tab<?php if ( 'add-codes' == $action ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Add Codes', 'new-user-approve-options' ); ?></a>
174
+ <a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->screen_name, 'action' => 'Settings' ), admin_url( 'admin.php' ) ) ); ?>" class="nav-tab<?php if ( 'Settings' == $action ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Settings', 'new-user-approve-options' ); ?></a>
175
+ <a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->screen_name, 'action' => 'import-codes' ), admin_url( 'admin.php' ) ) ); ?>" class="nav-tab<?php if ( 'import-codes' == $action ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Import Codes', 'new-user-approve-options' ); ?></a>
176
+ <a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->screen_name, 'action' => 'email' ), admin_url( 'admin.php' ) ) ); ?>" class="nav-tab<?php if ( 'email' == $action ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Email', 'new-user-approve-options' ); ?></a>
177
+
178
+ </h2>
179
+ <?php
180
+ $tab = ( isset( $_GET['tab'] ) ) ? $_GET['tab'] : '';
181
+ $tab = ( empty( $tab ) && !isset($_GET['action']) ) ? 'manual' : $tab;
182
+ ?>
183
+ <h2 class="nav-subtab-wrapper">
184
+
185
+ <a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->screen_name, 'tab' => 'manual' ), admin_url( 'admin.php' ) ) ); ?>" class="nav-tab<?php if ( 'manual' == $tab ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manual Generate', 'new-user-approve-options' ); ?></a>
186
+ <a href="<?php echo esc_url( add_query_arg( array( 'page' => $this->screen_name, 'tab' => 'auto' ), admin_url( 'admin.php' ) ) ); ?>" class="nav-tab<?php if ( 'auto' == $tab ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Auto Generate', 'new-user-approve-options' ); ?></a>
187
+
188
+
189
+ </h2>
190
+ <?php
191
+
192
+
193
+
194
+ $this->get_the_required_tab($action, $tab);
195
+
196
+ }
197
+
198
+ public function get_the_required_tab($action, $tab) {
199
+
200
+ if ( 'add-codes' == $action ) {
201
+
202
+ if ( 'manual' == $tab ) {
203
+ $this->manual_add_codes();
204
+ } else {
205
+ // 'auto' == $tab
206
+ $this->auto_add_codes();
207
+ }
208
+
209
+ }
210
+ else if ( 'import-codes' == $action ) {
211
+ $this->import_codes();
212
+ } else if ( 'email' == $action ) {
213
+ $this->email();
214
+ } else if ( 'Settings' == $action ) {
215
+ $this->option_invitation_code();
216
+ }
217
+
218
+ }
219
+
220
+ public function manual_add_codes() {
221
+ $count = 0;
222
+ if(isset($_POST['nua_manual_add'])){
223
+
224
+ $limit = empty($_POST['nua_manual_add']['usage_limit']) ? 1 : absint( $_POST['nua_manual_add']['usage_limit']);
225
+ $expiry = sanitize_text_field( $_POST['nua_manual_add']['expiry_date']);
226
+ $Status='Active';
227
+ $dateTime = new DateTime(str_replace('/','-',$expiry));
228
+ $expiry_timestamp = $dateTime->format('U');
229
+ $code= $_POST['nua_manual_add']['codes'];
230
+ $code= explode("\n", $code );
231
+
232
+ foreach($code as $in_code){
233
+ if(empty(trim($in_code)))
234
+ {
235
+
236
+ continue;
237
+ }
238
+ $my_post = array(
239
+ 'post_title' =>sanitize_text_field( $in_code ),
240
+ 'post_status' => 'publish',
241
+ 'post_type' => $this->code_post_type,
242
+
243
+ );
244
+
245
+ $post_code =wp_insert_post( $my_post );
246
+ if(!empty($post_code)){
247
+ update_post_meta($post_code, $this->code_key,sanitize_text_field( $in_code ));
248
+ update_post_meta($post_code, $this->usage_limit_key, $limit );
249
+ update_post_meta($post_code, $this->total_code_key, $limit );
250
+ update_post_meta($post_code, $this->expiry_date_key, $expiry_timestamp );
251
+ update_post_meta($post_code, $this->status_key, $Status );
252
+
253
+ $count++;
254
+ }
255
+
256
+
257
+
258
+ }
259
+ if(!empty($count)){
260
+
261
+ '<p class="nua-success" >';
262
+ echo __( sprintf("Post Successfully Added.",$count), 'new-user-approve-options');
263
+ '</p>';
264
+ }
265
+ else {
266
+
267
+ '<p class="nua-fail" >';
268
+ echo __( sprintf("Post Not Added.",$count), 'new-user-approve-options');
269
+ '</p>';
270
+ }
271
+ }
272
+
273
+
274
+ ?>
275
+ <form method="post" action=''>
276
+
277
+ <table class="form-table" role="presentation">
278
+ <tbody>
279
+ <tr>
280
+ <th><?php _e( 'Add Codes', 'new-user-approve-options' ); ?></th>
281
+ <td>
282
+ <div style="max-width: 600px;">
283
+ <textarea id="nua_manual_add_add_codes" name="nua_manual_add[codes]" required class="nua-textarea"></textarea>
284
+ </div>
285
+ <p class="description"><?php _e( 'Enter one code per line.', 'new-user-approve-options' ); ?></p>
286
+ </td>
287
+ </tr>
288
+ <tr>
289
+ <th><?php _e( 'Usage Limit', 'new-user-approve-options' ); ?></th>
290
+ <td>
291
+ <input id="nua_manual_add_usage_limit" name="nua_manual_add[usage_limit]" placeholder="1" size="40" type="text" class="nua-text-field">
292
+ </td>
293
+ </tr>
294
+ <tr>
295
+ <th><?php _e( 'Expiry Date', 'new-user-approve-options' ); ?></th>
296
+ <td>
297
+ <input id="nua_manual_add_expiry_date" name="nua_manual_add[expiry_date]" size="40" type="date" class="nua-text-field">
298
+
299
+ </td>
300
+ </tr>
301
+ <tr>
302
+ <th colspan="2">
303
+ <p class="submit nua-submit"><input type="submit" name="nua_manual_add[submit]" id="submit" class="button button-primary" value="Save Changes"></p>
304
+
305
+ </th>
306
+ </tr>
307
+ </tbody>
308
+ </form>
309
+ </table>
310
+ <?php
311
+
312
+
313
+ }
314
+
315
+ public function auto_add_codes() {
316
+ echo '<h2>Get pro version to avail these feature<br></h2>';
317
+ echo "<h3><a href='https://newuserapprove.com/options-addon' target = _blank>Click here to get the Pro Version</a></h3>";
318
+ }
319
+ public function import_codes() {
320
+
321
+ echo '<h2>Get pro version to avail these feature<br></h2>';
322
+ echo "<h3><a href='https://newuserapprove.com/options-addon' target = _blank>Click here to get the Pro Version</a></h3>";
323
+ }
324
+ public function email() {
325
+ echo '<h2>Get pro version to avail these feature<br></h2>';
326
+ echo "<h3><a href='https://newuserapprove.com/options-addon' target = _blank>Click here to get the Pro Version</a></h3>";
327
+ }
328
+
329
+
330
+ public function get_available_invitation_codes() {
331
+
332
+ $args = array (
333
+ 'numberposts' => -1,
334
+ 'post_type' => $this->code_post_type,
335
+ 'post_status' => 'publish',
336
+ 'meta_query' =>
337
+ array(
338
+ 'relation' => 'AND',
339
+ array(
340
+ array(
341
+ 'key' => $this->usage_limit_key,
342
+ 'value' => '1',
343
+ 'compare' => '>=',
344
+ ),
345
+
346
+ array(
347
+ 'key' => $this->expiry_date_key,
348
+ 'value' => time(),
349
+ 'compare' => '>=',
350
+ ),
351
+ array(
352
+ 'key' => $this->status_key,
353
+ 'value' => 'Active',
354
+ 'compare' => '=',
355
+ ),
356
+
357
+ ),
358
+
359
+ ),
360
+
361
+ );
362
+
363
+ $codes = get_posts( $args );
364
+
365
+ return $codes;
366
+ }
367
+
368
+ /**
369
+ * Output the Meta Value
370
+ */
371
+ public function add_invitation_meta(){
372
+ add_meta_box( 'nua_invitation', __( 'Invitation code for new user', 'new-user-approve-options' ), array($this, 'funct_nua_invitation'), $this->code_post_type );
373
+ }
374
+ public function funct_nua_invitation(){
375
+
376
+ $code = get_post_meta(get_the_ID(), $this->code_key, true );
377
+ $useage = get_post_meta(get_the_ID(),$this->usage_limit_key, true );
378
+ $total_code_key = get_post_meta(get_the_ID(),$this->total_code_key, true );
379
+ $exp = get_post_meta(get_the_ID(), $this->expiry_date_key, true );
380
+ $Status = get_post_meta(get_the_ID(), $this->status_key, true );
381
+ $convert_date = date('Y-m-d',absint( $exp ));
382
+ $registered_user = get_post_meta(get_the_ID(), $this->registered_users, true );
383
+
384
+ ?>
385
+ <form method="post" action=''>
386
+ <table class="form-table" role="presentation">
387
+ <tbody>
388
+ <tr>
389
+ <th scope="row"><?php _e("Invitation Code","new-user-approve-options")?></th>
390
+ <td><input type="text" name="codes" required value="<?php echo $code ?>" class="nua_codetxt"/><br>
391
+ </tr>
392
+ <tr>
393
+ <th scope="row"><?php _e("Uses left","new-user-approve-options")?></th>
394
+ <td><input type="text" name="usage_limit" required value="<?php echo $useage ?>" class="nua_codetxt"/><br>
395
+ </tr>
396
+ <tr>
397
+ <th scope="row"><?php _e("Usage Limit","new-user-approve-options")?></th>
398
+ <td><input type="text" name="total_code" required value="<?php echo $total_code_key ?>" class="nua_codetxt"/><br>
399
+ </tr>
400
+ <tr>
401
+ <th scope="row"><?php _e("Date","new-user-approve-options")?></th>
402
+ <td><input type="date" name="expiry_date" required value="<?php echo $convert_date ?>" class="nua_codetxt"/><br>
403
+ </tr>
404
+ <tr>
405
+ <th scope="row"><?php _e("Status","new-user-approve-options")?></th>
406
+ <td>
407
+ <select name="code_status" required class="nua_codetxt">
408
+ <option value='Active'<?php echo ('Active' == $Status ? 'selected' : '') ?> >Active</option>
409
+ <option value='InActive'<?php echo ('InActive' == $Status ? 'selected' : '') ?> > InActive</option>
410
+ <option value='Expire'<?php echo ('Expire' == $Status ? 'selected' : '') ?> > Expire</option>
411
+ </select>
412
+ </td>
413
+ </tr>
414
+ <tr>
415
+ <td colspan="2" ><table>
416
+ <p><?php _e('Users that have registered by using this invitation code','new-user-approve-options')?></p>
417
+ <thead>
418
+ <tr>
419
+ <th>USER-ID</th>
420
+ <th>USER-EMAIL</th>
421
+ <th>USER-LINK</th>
422
+ </tr>
423
+ </thead>
424
+ <tbody>
425
+
426
+ <?php
427
+ if (!empty($registered_user)) {
428
+
429
+ foreach ($registered_user as $userid) {
430
+ echo '<tr><td>' . $userid .'</td>';
431
+
432
+ $the_user = get_user_by( 'id', $userid);
433
+
434
+ if(!empty($the_user)){
435
+ $link =get_edit_user_link( $userid );
436
+ echo '<td>' .$the_user->user_email.'</td>';
437
+ echo '<td><a href=' .$link.'>'.$the_user->user_login .'</a></td>';
438
+
439
+ } else {
440
+ echo '<td>'.__("User Not Found","new-user-approve-options").'</td>';
441
+ }
442
+ echo '</tr> ';
443
+ }
444
+ } else {
445
+ echo '<tr colspan="3"><td>'.__("No User Found","new-user-approve-options").'</td></tr>';
446
+ }
447
+ ?>
448
+ </tbody>
449
+ </table></td>
450
+ </tr>
451
+ </tbody>
452
+ </table>
453
+ </form>
454
+ <?php
455
+
456
+ }
457
+
458
+ public function save_nua_invitation(){
459
+
460
+ if ( isset( $_POST['post_type'] ) && $this->code_post_type == $_POST['post_type'] ) {
461
+
462
+ $code = sanitize_text_field($_POST['codes']);
463
+ $usage = absint($_POST['usage_limit']);
464
+ $use_limit = absint($_POST['total_code']);
465
+ $Expiry = sanitize_text_field($_POST['expiry_date']);
466
+ $Status = sanitize_text_field($_POST['code_status']);
467
+ $dateTime = new DateTime(str_replace('/','-',$Expiry));
468
+ $expiry_timestamp = $dateTime->format('U');
469
+ update_post_meta( get_the_ID(), $this->code_key, $code );
470
+ update_post_meta( get_the_ID(), $this->usage_limit_key, $usage );
471
+ update_post_meta( get_the_ID(), $this->total_code_key, $use_limit );
472
+ update_post_meta( get_the_ID(), $this->expiry_date_key, $expiry_timestamp );
473
+ update_post_meta( get_the_ID(), $this->status_key, $Status );
474
+ }
475
+
476
+ }
477
+
478
+ public function nua_invitation_code_field(){
479
+ ?>
480
+ <p>
481
+ <label> <?php _e('Invitation Code', 'new-user-approve-options'); ?></label>
482
+ <input type="text" class="nua_invitation_code" name="nua_invitation_code"/>
483
+ </p>
484
+ <?php
485
+ }
486
+
487
+ public function nua_invitation_status_code( $status, $user_id ){
488
+
489
+ if ( isset($_POST['nua_invitation_code']) && !empty($_POST['nua_invitation_code'])) {
490
+ $args = array (
491
+ 'numberposts' => -1,
492
+ 'post_type' => $this->code_post_type,
493
+ 'post_status' => 'publish',
494
+ 'meta_query' =>
495
+ array(
496
+ 'relation' => 'AND',
497
+ array(
498
+ array(
499
+ 'key' => $this->code_key,
500
+ 'value' => sanitize_text_field($_POST['nua_invitation_code']),
501
+ 'compare' => '=',
502
+ ),
503
+ array(
504
+ 'key' => $this->usage_limit_key,
505
+ 'value' => '1',
506
+ 'compare' => '>=',
507
+ ),
508
+ array(
509
+ 'key' => $this->expiry_date_key,
510
+ 'value' => time(),
511
+ 'compare' => '>=',
512
+ ),
513
+ array(
514
+ 'key' => $this->status_key,
515
+ 'value' => 'Active',
516
+ 'compare' => '=',
517
+ ),
518
+ ),
519
+
520
+ ),
521
+
522
+ );
523
+
524
+ $posts = get_posts( $args );
525
+
526
+
527
+ foreach ($posts as $post_inv) {
528
+
529
+ $code_inv = get_post_meta($post_inv->ID , $this->code_key, true );
530
+
531
+ if (sanitize_text_field($_POST['nua_invitation_code']) == $code_inv) {
532
+ $register_user = get_post_meta($post_inv->ID , $this->registered_users, true );
533
+
534
+ if (empty($register_user)){
535
+ update_post_meta( $post_inv->ID,$this->registered_users,array( $user_id));
536
+
537
+ } else {
538
+ //$unserilize_array = unserialize($register_user);
539
+ $register_user[]= $user_id;
540
+ update_post_meta( $post_inv->ID,$this->registered_users,$register_user);
541
+
542
+ }
543
+ $current_useage = get_post_meta( $post_inv->ID,$this->usage_limit_key, true );
544
+ $current_useage= $current_useage - 1;
545
+ update_post_meta( $post_inv->ID,$this->usage_limit_key,$current_useage );
546
+ if ($current_useage == 0) {
547
+ update_post_meta( $post_inv->ID, $this->status_key,'Expired');
548
+ }
549
+ $status = 'approved';
550
+ return $status;
551
+
552
+ }
553
+ }
554
+ }
555
+ return $status;
556
+ }
557
+ public function invitation_code_columns( $columns ) {
558
+ unset($columns['date']);
559
+ unset($columns['title']);
560
+ $columns['inv_code'] = __( 'Invitation Code', 'new-user-approve-options' );
561
+ $columns['usage'] = __( 'Uses Remaining', 'new-user-approve-options' );
562
+ $columns['expiry'] = __( 'Expiry', 'new-user-approve-options' );
563
+ $columns['status'] = __( 'Status', 'new-user-approve-options' );
564
+ $columns['actions'] = __( 'Actions', 'new-user-approve-options' );
565
+
566
+ return $columns;
567
+ }
568
+
569
+ public function invitation_code_columns_content($column, $post_id) {
570
+
571
+ switch ( $column ) {
572
+
573
+ case 'usage' :
574
+ echo get_post_meta( $post_id , $this->usage_limit_key , true ).'/'.get_post_meta( $post_id , $this->total_code_key , true );
575
+ break;
576
+
577
+ case 'expiry' :
578
+ $exp_date = get_post_meta( $post_id , $this->expiry_date_key , true );
579
+ if (!empty($exp_date)) {
580
+ echo date('Y-m-d',$exp_date);
581
+ }
582
+ break;
583
+ case 'status' :
584
+ echo get_post_meta( $post_id , $this->status_key , true );
585
+ break;
586
+ case 'inv_code' :
587
+ echo get_post_meta( $post_id , $this->code_key , true );
588
+ break;
589
+ case 'actions' :
590
+ if( 'trash' != get_post_status( $post_id )) {
591
+ $deactivate_link = admin_url( 'edit.php?post_type='.$this->code_post_type );
592
+ $deactivate_link.= '&nua_action=deactivate&post_id='.$post_id.'&nonce='.wp_create_nonce('nua_deactivate-'.$post_id);
593
+ ?>
594
+ <a href="<?php echo $deactivate_link; ?>"><?php _e('Deactivate', 'new-user-approve-options'); ?></a> | <a href="<?php echo get_edit_post_link( $post_id ); ?>"><?php _e('Edit', 'new-user-approve-options'); ?></a> | <a href="<?php echo get_delete_post_link( $post_id ); ?>"><?php _e('Delete', 'new-user-approve-options'); ?></a>
595
+ <?php
596
+ }
597
+
598
+ break;
599
+ }
600
+ }
601
+ public function option_invitation_code() {
602
+
603
+ if ( isset( $_POST['nua_free_invitation'] ) && $_POST['nua_free_invitation'] == 'enable'){
604
+ update_option('nua_free_invitation', sanitize_text_field($_POST['nua_free_invitation']));
605
+ } else if (isset($_POST['nua_inv_code_submit']) ) {
606
+ update_option('nua_free_invitation', '');
607
+ }
608
+ $options = get_option( 'nua_free_invitation' );
609
+ $invitation_code_invite = ( $options == 'enable' ) ? $options : false;
610
+
611
+ echo '<form method="post" action="">';
612
+ echo '<label class="nua_switch" for="nua_free_invitation"><input id="nua_free_invitation" name="nua_free_invitation" type="checkbox" value="enable" ' . checked( $invitation_code_invite, 'enable', false ) . '/><span class="nua_slider round"></span></label>';
613
+ echo '<p class="description">' . __( 'Invitation Code for user to register without hesitation', 'new-user-approve-options' ) . '</p>';
614
+ echo '<tr>
615
+ <th colspan="2">
616
+ <p class="submit nua-submit"><input type="submit" name="nua_inv_code_submit" id="submit" class="button button-primary" value="Save Changes"></p>
617
+ </th>
618
+ </tr>
619
+ </form>';
620
+
621
+ }
622
+
623
+
624
+
625
+ } // End Class
626
+
627
+ function nua_invitation_code() {
628
+
629
+
630
+ return nua_invitation_code::instance();
631
+
632
+
633
+ }
634
+
635
+ nua_invitation_code();
includes/user-list.php CHANGED
@@ -54,6 +54,7 @@ class pw_new_user_approve_user_list {
54
  $sendback = admin_url( 'users.php' );
55
 
56
  $wp_list_table = _get_list_table( 'WP_Users_List_Table' );
 
57
  $pagenum = $wp_list_table->get_pagenum();
58
  $sendback = add_query_arg( 'paged', $pagenum, $sendback );
59
 
54
  $sendback = admin_url( 'users.php' );
55
 
56
  $wp_list_table = _get_list_table( 'WP_Users_List_Table' );
57
+
58
  $pagenum = $wp_list_table->get_pagenum();
59
  $sendback = add_query_arg( 'paged', $pagenum, $sendback );
60
 
new-user-approve.php CHANGED
@@ -5,7 +5,7 @@
5
  Plugin URI: http://newuserapprove.com/
6
  Description: Allow administrators to approve users once they register. Only approved users will be allowed to access the site. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
7
  Author: NewUserApprove
8
- Version: 1.9.1
9
  Author URI: https://newuserapprove.com/
10
  Text Domain: new-user-approve
11
  */
@@ -27,8 +27,16 @@ if ( !function_exists( 'nua_fs' ) ) {
27
  'is_premium' => false,
28
  'premium_suffix' => 'Premium',
29
  'has_addons' => false,
30
- 'has_paid_plans' => true,
31
-
 
 
 
 
 
 
 
 
32
  'is_live' => true,
33
  ) );
34
  }
@@ -81,6 +89,7 @@ class pw_new_user_approve
81
  add_action( 'new_user_approve_approve_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
82
  add_action( 'new_user_approve_deny_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
83
  add_action( 'deleted_user', array( $this, 'delete_new_user_approve_transient' ) );
 
84
  //add_action( 'register_post', array( $this, 'request_admin_approval_email' ), 10, 3 );
85
  add_action(
86
  'register_post',
@@ -137,6 +146,9 @@ class pw_new_user_approve
137
  {
138
  require_once $this->get_plugin_dir() . 'includes/email-tags.php';
139
  require_once $this->get_plugin_dir() . 'includes/messages.php';
 
 
 
140
  }
141
 
142
  /**
@@ -468,6 +480,17 @@ class pw_new_user_approve
468
  *
469
  * @uses rightnow_end
470
  */
 
 
 
 
 
 
 
 
 
 
 
471
  public function dashboard_stats()
472
  {
473
  $user_status = $this->get_count_of_user_statuses();
5
  Plugin URI: http://newuserapprove.com/
6
  Description: Allow administrators to approve users once they register. Only approved users will be allowed to access the site. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
7
  Author: NewUserApprove
8
+ Version: 2.0
9
  Author URI: https://newuserapprove.com/
10
  Text Domain: new-user-approve
11
  */
27
  'is_premium' => false,
28
  'premium_suffix' => 'Premium',
29
  'has_addons' => false,
30
+ 'has_paid_plans' => false,
31
+ 'has_premium_version' => true,
32
+ 'has_affiliation' => 'selected',
33
+ 'menu' => array(
34
+ 'slug' => 'new-user-approve-admin',
35
+ 'contact' => false,
36
+ 'support' => false,
37
+ 'account' => false,
38
+ 'pricing' => false,
39
+ ),
40
  'is_live' => true,
41
  ) );
42
  }
89
  add_action( 'new_user_approve_approve_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
90
  add_action( 'new_user_approve_deny_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
91
  add_action( 'deleted_user', array( $this, 'delete_new_user_approve_transient' ) );
92
+ add_action('admin_enqueue_scripts', array( $this, 'nua_admin_scripts' ));
93
  //add_action( 'register_post', array( $this, 'request_admin_approval_email' ), 10, 3 );
94
  add_action(
95
  'register_post',
146
  {
147
  require_once $this->get_plugin_dir() . 'includes/email-tags.php';
148
  require_once $this->get_plugin_dir() . 'includes/messages.php';
149
+ require_once $this->get_plugin_dir() . 'includes/invitation-code.php';
150
+
151
+
152
  }
153
 
154
  /**
480
  *
481
  * @uses rightnow_end
482
  */
483
+
484
+ /**
485
+ * Add scripts and styles for New User Approve admin pages
486
+ */
487
+ public function nua_admin_scripts() {
488
+ $pages = array('new-user-approve-auto-approve', 'nua-invitation-code', 'new-user-approve', 'new-user-approve-admin');
489
+
490
+ if (isset($_GET['page']) && in_array($_GET['page'], $pages)) {
491
+ wp_enqueue_style( 'nua-admin-style', plugins_url( '/assets/css/nua-admin-style.css', __FILE__ ), array());
492
+ }
493
+ }
494
  public function dashboard_stats()
495
  {
496
  $user_status = $this->get_count_of_user_statuses();
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: wpexpertsio
3
  Donate link: https://newuserapprove.com
4
  Tags: users, registration, sign up, user management, login, user approval
5
  Requires at least: 4.0
6
- Tested up to: 5.8.1
7
- Stable tag: 1.9.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -32,13 +32,18 @@ Only approved users will be allowed to log in to the site. Thus, users waiting f
32
 
33
  The user’s status can be updated even after the initial approval/denial request. Also, users that have been created before the activation of **New User Approve** will be treated as approved users.
34
 
35
- [youtube https://www.youtube.com/watch?v=RowV3wmD_jg]
36
-
37
- **New and improved user interface**
38
  The overall interface has been revised and improved for a trendy, fresh, and minimal look. The latest design includes a whole new look and experience for the layout so your users can have an experience unlike any other.
39
 
40
  The clean and easy user interface always helps the existing and the new customers gain confidence in your website.
41
 
 
 
 
 
 
 
 
42
  **Compatibility**
43
  New User Approve is compatible with [WooCommerce](https://woocommerce.com/), [MemberPress](https://memberpress.com/), [WP-Foro](https://wpforo.com/), [Learndash](https://www.learndash.com/), and [Ultimate Member](https://ultimatemember.com/).
44
 
@@ -73,6 +78,9 @@ A commercial plugin that adds a config panel for customization is also available
73
  - *new_user_approve_approve_user* – when the user has been approved
74
  - *new_user_approve_deny_user* – when the user has been denied
75
 
 
 
 
76
  **New User Approve Pro features**
77
  [Download Premium from here](https://newuserapprove.com/options-addon)
78
 
@@ -93,8 +101,6 @@ A commercial plugin that adds a config panel for customization is also available
93
  * Suppress denial notification/s.
94
  * Option to send all notification/s in the HTML format.
95
  * Different template tags can be used in Notification Emails and other messages.
96
- * Features (Auto-approve and Invitation codes) are compatible with Memberpress.
97
- * Fully compatible with WooCommerce's registration mechanism.
98
  * Invitation codes to invite and approve users automatically.
99
  * Invitation codes can be generated manually and automatically.
100
  * Import invitation codes via CSV file.
@@ -159,14 +165,20 @@ We are aware of a few issues with multisite
159
 
160
  == Screenshots ==
161
 
162
- 1. The backend to manage approving and denying users. This is an alternative to approving users.
163
- 2. Integration with WordPress Users admin page.
164
- 3. Filter users by status.
165
- 4. Approve or deny users using the bulk edit feature in WordPress.
166
- 5. Custom messages on the login screen.
 
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
170
  = 1.9.1 =
171
  * Added filter to enable/disable auto login on WooCommerce checkout, by default it will be enabled.
172
 
3
  Donate link: https://newuserapprove.com
4
  Tags: users, registration, sign up, user management, login, user approval
5
  Requires at least: 4.0
6
+ Tested up to: 5.9
7
+ Stable tag: 2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
32
 
33
  The user’s status can be updated even after the initial approval/denial request. Also, users that have been created before the activation of **New User Approve** will be treated as approved users.
34
 
35
+ **New and improved user interface in Version 2.0**
 
 
36
  The overall interface has been revised and improved for a trendy, fresh, and minimal look. The latest design includes a whole new look and experience for the layout so your users can have an experience unlike any other.
37
 
38
  The clean and easy user interface always helps the existing and the new customers gain confidence in your website.
39
 
40
+ **Send invitation codes**
41
+ Make the registration process easier by sending the invitation code to those who you want to skip the process altogether. People who user the invitation codes are auto-approved by the system.
42
+
43
+ The invitation codes will be genrated manually and work smoothly with WooCommerce's registration mechanism. They can also be edited and deactivated at any time.
44
+
45
+ [youtube https://www.youtube.com/watch?v=RowV3wmD_jg]
46
+
47
  **Compatibility**
48
  New User Approve is compatible with [WooCommerce](https://woocommerce.com/), [MemberPress](https://memberpress.com/), [WP-Foro](https://wpforo.com/), [Learndash](https://www.learndash.com/), and [Ultimate Member](https://ultimatemember.com/).
49
 
78
  - *new_user_approve_approve_user* – when the user has been approved
79
  - *new_user_approve_deny_user* – when the user has been denied
80
 
81
+ == DOCUMENTATION ==
82
+ [Click here](https://newuserapprove.com/documentation/#installation-guide) to view the detailed technical documentation of New User Approve Free Version. The documentation includes a step-by-step configuration guide and troubleshooting.
83
+
84
  **New User Approve Pro features**
85
  [Download Premium from here](https://newuserapprove.com/options-addon)
86
 
101
  * Suppress denial notification/s.
102
  * Option to send all notification/s in the HTML format.
103
  * Different template tags can be used in Notification Emails and other messages.
 
 
104
  * Invitation codes to invite and approve users automatically.
105
  * Invitation codes can be generated manually and automatically.
106
  * Import invitation codes via CSV file.
165
 
166
  == Screenshots ==
167
 
168
+ 1. User Registration Approval - Pending Users.
169
+ 2. User Registration Approval - Approved Users.
170
+ 3. User Registration Approval - Denied Users.
171
+ 4. Invitation Code Settings - Add Codes.
172
+ 5. Invitation Code Settings - Settings.
173
+ 6. Pro Features.
174
 
175
  == Changelog ==
176
 
177
+ = 2.0 =
178
+ * Updated- Plugin menu.
179
+ * Added- the invitation code functionality.
180
+ * Improved backend UI.
181
+
182
  = 1.9.1 =
183
  * Added filter to enable/disable auto login on WooCommerce checkout, by default it will be enabled.
184