New User Approve - Version 1.5

Version Description

  • add more logic to prevent unwanted password resets
  • add more translations
  • minor bug fixes
  • use core definition of tabs
  • user query updates (requires 3.5)
  • add status attribute to user profile page
  • integration with core user table (bulk approve, filtering, etc.)
  • tested with WordPress 3.6
  • set email header when sending email
  • more filters and actions
Download this release

Release Info

Developer picklewagon
Plugin Icon 128x128 New User Approve
Version 1.5
Comparing to
See all releases

Code changes from version 1.4.2 to 1.5

includes/admin-approve.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class pw_new_user_approve_admin_approve
5
+ * Admin must approve all new users
6
+ */
7
+
8
+ class pw_new_user_approve_admin_approve {
9
+
10
+ var $_admin_page = 'new-user-approve-admin';
11
+
12
+ /**
13
+ * The only instance of pw_new_user_approve_admin_approve.
14
+ *
15
+ * @var pw_new_user_approve_admin_approve
16
+ */
17
+ private static $instance;
18
+
19
+ /**
20
+ * Returns the main instance.
21
+ *
22
+ * @return pw_new_user_approve_admin_approve
23
+ */
24
+ public static function instance() {
25
+ if ( ! isset( self::$instance ) ) {
26
+ self::$instance = new pw_new_user_approve_admin_approve();
27
+ }
28
+ return self::$instance;
29
+ }
30
+
31
+ private function __construct() {
32
+ // Actions
33
+ add_action( 'admin_menu', array( $this, 'admin_menu_link' ) );
34
+ add_action( 'init', array( $this, 'process_input' ) );
35
+ add_action( 'admin_notices', array( $this, 'admin_notice' ) );
36
+ add_action( 'admin_init', array( $this, 'notice_ignore' ) );
37
+ }
38
+
39
+ /**
40
+ * Add the new menu item to the users portion of the admin menu
41
+ *
42
+ * @uses admin_menu
43
+ */
44
+ function admin_menu_link() {
45
+ $show_admin_page = apply_filters( 'new_user_approve_show_admin_page', true );
46
+
47
+ if ( $show_admin_page ) {
48
+ $cap = apply_filters( 'new_user_approve_minimum_cap', 'edit_users' );
49
+ add_users_page( __( 'Approve New Users', 'new-user-approve' ), __( 'Approve New Users', 'new-user-approve' ), $cap, $this->_admin_page, array( $this, 'approve_admin' ) );
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Create the view for the admin interface
55
+ */
56
+ public function approve_admin() {
57
+ if ( isset( $_GET['user'] ) && isset( $_GET['status'] ) ) {
58
+ echo '<div id="message" class="updated fade"><p>'.__( 'User successfully updated.', 'new-user-approve' ).'</p></div>';
59
+ }
60
+
61
+ $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'pending_users';
62
+ ?>
63
+ <div class="wrap">
64
+ <h2><?php _e( 'User Registration Approval', 'new-user-approve' ); ?></h2>
65
+
66
+ <h3 class="nav-tab-wrapper">
67
+ <a href="<?php echo esc_url( admin_url( 'users.php?page=new-user-approve-admin&tab=pending_users' ) ); ?>" class="nav-tab<?php echo $active_tab == 'pending_users' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Users Pending Approval', 'new-user-approve' ); ?></span></a>
68
+ <a href="<?php echo esc_url( admin_url( 'users.php?page=new-user-approve-admin&tab=approved_users' ) ); ?>" class="nav-tab<?php echo $active_tab == 'approved_users' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Approved Users', 'new-user-approve' ); ?></span></a>
69
+ <a href="<?php echo esc_url( admin_url( 'users.php?page=new-user-approve-admin&tab=denied_users' ) ); ?>" class="nav-tab<?php echo $active_tab == 'denied_users' ? ' nav-tab-active' : ''; ?>"><span><?php _e( 'Denied Users', 'new-user-approve' ); ?></span></a>
70
+ </h3>
71
+
72
+ <?php if ( $active_tab == 'pending_users' ) : ?>
73
+ <div id="pw_pending_users">
74
+ <?php $this->user_table( 'pending' ); ?>
75
+ </div>
76
+ <?php elseif ( $active_tab == 'approved_users') : ?>
77
+ <div id="pw_approved_users">
78
+ <?php $this->user_table( 'approved' ); ?>
79
+ </div>
80
+ <?php elseif ( $active_tab == 'denied_users') : ?>
81
+ <div id="pw_denied_users">
82
+ <?php $this->user_table( 'denied' ); ?>
83
+ </div>
84
+ <?php endif; ?>
85
+ </div>
86
+ <?php
87
+ }
88
+
89
+ /**
90
+ * Output the table that shows the registered users grouped by status
91
+ *
92
+ * @param string $status the filter to use for which the users will be queried. Possible values are pending, approved, or denied.
93
+ */
94
+ public function user_table( $status ) {
95
+ global $current_user;
96
+
97
+ $approve = ( 'denied' == $status || 'pending' == $status );
98
+ $deny = ( 'approved' == $status || 'pending' == $status );
99
+
100
+ $user_status = pw_new_user_approve()->get_user_statuses();
101
+ $users = $user_status[$status];
102
+
103
+ if ( count( $users ) > 0 ) {
104
+ ?>
105
+ <table class="widefat">
106
+ <thead>
107
+ <tr class="thead">
108
+ <th><?php _e( 'Username', 'new-user-approve' ); ?></th>
109
+ <th><?php _e( 'Name', 'new-user-approve' ); ?></th>
110
+ <th><?php _e( 'E-mail', 'new-user-approve' ); ?></th>
111
+ <?php if ( 'pending' == $status ) { ?>
112
+ <th colspan="2" style="text-align: center"><?php _e( 'Actions', 'new-user-approve' ); ?></th>
113
+ <?php } else { ?>
114
+ <th style="text-align: center"><?php _e( 'Actions', 'new-user-approve' ); ?></th>
115
+ <?php } ?>
116
+ </tr>
117
+ </thead>
118
+ <tbody>
119
+ <?php
120
+ // show each of the users
121
+ $row = 1;
122
+ foreach ( $users as $user ) {
123
+ $class = ( $row % 2 ) ? '' : ' class="alternate"';
124
+ $avatar = get_avatar( $user->user_email, 32 );
125
+
126
+ if ( $approve ) {
127
+ $approve_link = get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=approve';
128
+ $approve_link = wp_nonce_url( $approve_link, 'pw_new_user_approve_action_' . get_class( $this ) );
129
+ }
130
+ if ( $deny ) {
131
+ $deny_link = get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=deny';
132
+ $deny_link = wp_nonce_url( $deny_link, 'pw_new_user_approve_action_' . get_class( $this ) );
133
+ }
134
+
135
+ if ( current_user_can( 'edit_user', $user->ID ) ) {
136
+ if ($current_user->ID == $user->ID) {
137
+ $edit_link = 'profile.php';
138
+ } else {
139
+ $edit_link = add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user->ID" );
140
+ }
141
+ $edit = '<strong><a href="' . esc_url( $edit_link ) . '">' . esc_html( $user->user_login ) . '</a></strong>';
142
+ } else {
143
+ $edit = '<strong>' . esc_html( $user->user_login ) . '</strong>';
144
+ }
145
+
146
+ ?><tr <?php echo $class; ?>>
147
+ <td><?php echo $avatar . ' ' . $edit; ?></td>
148
+ <td><?php echo get_user_meta( $user->ID, 'first_name', true ) . ' ' . get_user_meta( $user->ID, 'last_name', true ); ?></td>
149
+ <td><a href="mailto:<?php echo $user->user_email; ?>" title="<?php _e('email:', 'new-user-approve' ) ?> <?php echo $user->user_email; ?>"><?php echo $user->user_email; ?></a></td>
150
+ <?php if ( $approve && $user->ID != get_current_user_id() ) { ?>
151
+ <td align="center"><a href="<?php echo esc_url( $approve_link ); ?>" title="<?php _e( 'Approve', 'new-user-approve' ); ?> <?php echo $user->user_login; ?>"><?php _e( 'Approve', 'new-user-approve' ); ?></a></td>
152
+ <?php } ?>
153
+ <?php if ( $deny && $user->ID != get_current_user_id() ) { ?>
154
+ <td align="center"><a href="<?php echo esc_url( $deny_link ); ?>" title="<?php _e( 'Deny', 'new-user-approve' ); ?> <?php echo $user->user_login; ?>"><?php _e( 'Deny', 'new-user-approve' ); ?></a></td>
155
+ <?php } ?>
156
+ <?php if ( $user->ID == get_current_user_id() ) : ?>
157
+ <td colspan="2">&nbsp;</td>
158
+ <?php endif; ?>
159
+ </tr><?php
160
+ $row++;
161
+ }
162
+ ?>
163
+ </tbody>
164
+ </table>
165
+ <?php
166
+ } else {
167
+ $status_i18n = $status;
168
+ if ( $status == 'approved' ) {
169
+ $status_i18n = __( 'approved', 'new-user-approve' );
170
+ } else if ( $status == 'denied' ) {
171
+ $status_i18n = __( 'denied', 'new-user-approve' );
172
+ } else if ( $status == 'pending' ) {
173
+ $status_i18n = __( 'pending', 'new-user-approve' );
174
+ }
175
+
176
+ echo '<p>'.sprintf( __( 'There are no users with a status of %s', 'new-user-approve' ), $status_i18n ) . '</p>';
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Accept input from admin to modify a user
182
+ *
183
+ * @uses init
184
+ */
185
+ public function process_input() {
186
+ if ( ( isset( $_GET['page'] ) && $_GET['page'] == $this->_admin_page ) && isset( $_GET['status'] ) ) {
187
+ $valid_request = check_admin_referer( 'pw_new_user_approve_action_' . get_class( $this ) );
188
+
189
+ if ( $valid_request ) {
190
+ $status = sanitize_key( $_GET['status'] );
191
+ $user_id = absint( $_GET['user'] );
192
+
193
+ pw_new_user_approve()->update_user_status( $user_id, $status );
194
+ }
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Display a notice on the legacy page that notifies the user of the new interface.
200
+ *
201
+ * @uses admin_notices
202
+ */
203
+ public function admin_notice() {
204
+ $screen = get_current_screen();
205
+
206
+ if ( $screen->id == 'users_page_new-user-approve-admin' ) {
207
+ $user_id = get_current_user_id();
208
+
209
+ // Check that the user hasn't already clicked to ignore the message
210
+ if ( ! get_user_meta( $user_id, 'pw_new_user_approve_ignore_notice' ) ) {
211
+ echo '<div class="updated"><p>';
212
+ printf( __( 'You can now update user status on the <a href="%1$s">users admin page</a>. | <a href="%2$s">Hide Notice</a>', 'new-user-approve' ), admin_url( 'users.php' ), add_query_arg( array( 'new-user-approve-ignore-notice' => 1 ) ) );
213
+ echo "</p></div>";
214
+ }
215
+ }
216
+ }
217
+
218
+ /**
219
+ * If user clicks to ignore the notice, add that to their user meta
220
+ *
221
+ * @uses admin_init
222
+ */
223
+ public function notice_ignore() {
224
+ if ( isset( $_GET['new-user-approve-ignore-notice'] ) && '1' == $_GET['new-user-approve-ignore-notice '] ) {
225
+ $user_id = get_current_user_id();
226
+ add_user_meta( $user_id, 'pw_new_user_approve_ignore_notice', '1', true );
227
+ }
228
+ }
229
+
230
+ }
231
+
232
+ function pw_new_user_approve_admin_approve() {
233
+ return pw_new_user_approve_admin_approve::instance();
234
+ }
235
+
236
+ pw_new_user_approve_admin_approve();
includes/user-list.php ADDED
@@ -0,0 +1,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class pw_new_user_approve_user_list {
4
+
5
+ /**
6
+ * The only instance of pw_new_user_approve_user_list.
7
+ *
8
+ * @var pw_new_user_approve_user_list
9
+ */
10
+ private static $instance;
11
+
12
+ /**
13
+ * Returns the main instance.
14
+ *
15
+ * @return pw_new_user_approve_user_list
16
+ */
17
+ public static function instance() {
18
+ if ( ! isset( self::$instance ) ) {
19
+ self::$instance = new pw_new_user_approve_user_list();
20
+ }
21
+ return self::$instance;
22
+ }
23
+
24
+ private function __construct() {
25
+ // Actions
26
+ add_action( 'load-users.php', array( $this, 'update_action' ) );
27
+ add_action( 'restrict_manage_users', array( $this, 'status_filter' ) );
28
+ add_action( 'pre_user_query', array( $this, 'filter_by_status' ) );
29
+ add_action( 'admin_footer-users.php', array( $this, 'admin_footer' ) );
30
+ add_action( 'load-users.php', array( $this, 'bulk_action' ) );
31
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
32
+ add_action( 'show_user_profile', array( $this, 'profile_status_field' ) );
33
+ add_action( 'edit_user_profile', array( $this, 'profile_status_field' ) );
34
+ add_action( 'edit_user_profile_update', array( $this, 'save_profile_status_field' ) );
35
+
36
+ // Filters
37
+ add_filter( 'user_row_actions', array( $this, 'user_table_actions' ), 10, 2 );
38
+ add_filter( 'manage_users_columns', array( $this, 'add_column' ) );
39
+ add_filter( 'manage_users_custom_column', array( $this, 'status_column' ), 10, 3 );
40
+ }
41
+
42
+ /**
43
+ * Update the user status if the approve or deny link was clicked.
44
+ *
45
+ * @uses load-users.php
46
+ */
47
+ public function update_action() {
48
+ if ( isset( $_GET['new_user_approve_filter'] ) )
49
+ return;
50
+
51
+ if ( isset( $_GET['action'] ) && ( in_array( $_GET['action'], array( 'approve', 'deny' ) ) ) ) {
52
+ check_admin_referer( 'new-user-approve' );
53
+
54
+ $sendback = remove_query_arg( array( 'approved', 'denied', 'deleted', 'ids', 'new_user_approve_filter', 'pw-status-query-submit', 'new_role' ), wp_get_referer() );
55
+ if ( ! $sendback )
56
+ $sendback = admin_url( 'users.php' );
57
+
58
+ $wp_list_table = _get_list_table( 'WP_Users_List_Table' );
59
+ $pagenum = $wp_list_table->get_pagenum();
60
+ $sendback = add_query_arg( 'paged', $pagenum, $sendback );
61
+
62
+ $status = sanitize_key( $_GET['action'] );
63
+ $user = absint( $_GET['user'] );
64
+
65
+ pw_new_user_approve()->update_user_status( $user, $status );
66
+
67
+ if ( $_GET['action'] == 'approve' ) {
68
+ $sendback = add_query_arg( array( 'approved' => 1, 'ids' => $user ), $sendback );
69
+ } else {
70
+ $sendback = add_query_arg( array( 'denied' => 1, 'ids' => $user ), $sendback );
71
+ }
72
+
73
+ wp_redirect( $sendback );
74
+ exit;
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Add the approve or deny link where appropriate.
80
+ *
81
+ * @uses user_row_actions
82
+ * @param array $actions
83
+ * @param object $user
84
+ * @return array
85
+ */
86
+ public function user_table_actions( $actions, $user ) {
87
+ if ( $user->ID == get_current_user_id() )
88
+ return $actions;
89
+
90
+ $user_status = pw_new_user_approve()->get_user_status( $user->ID );
91
+
92
+ $approve_link = wp_nonce_url( add_query_arg( array( 'action' => 'approve', 'user' => $user->ID ) ), 'new-user-approve' );
93
+ $deny_link = wp_nonce_url( add_query_arg( array( 'action' => 'deny', 'user' => $user->ID ) ), 'new-user-approve' );
94
+
95
+ $approve_action = '<a href="' . esc_url( $approve_link ) . '">' . __( 'Approve', 'new-user-approve' ) . '</a>';
96
+ $deny_action = '<a href="' . esc_url( $deny_link ) . '">' . __( 'Deny', 'new-user-approve' ) . '</a>';
97
+
98
+ if ( $user_status == 'pending' ) {
99
+ $actions[] = $approve_action;
100
+ $actions[] = $deny_action;
101
+ } else if ( $user_status == 'approved' ) {
102
+ $actions[] = $deny_action;
103
+ } else if ( $user_status == 'denied' ) {
104
+ $actions[] = $approve_action;
105
+ }
106
+
107
+ return $actions;
108
+ }
109
+
110
+ /**
111
+ * Add the status column to the user table
112
+ *
113
+ * @uses manage_users_columns
114
+ * @param array $columns
115
+ * @return array
116
+ */
117
+ public function add_column( $columns ) {
118
+ $the_columns['pw_user_status'] = __( 'Status', 'new-user-approve' );
119
+
120
+ $newcol = array_slice( $columns, 0, -1 );
121
+ $newcol = array_merge( $newcol, $the_columns );
122
+ $columns = array_merge( $newcol, array_slice( $columns, 1 ) );
123
+
124
+ return $columns;
125
+ }
126
+
127
+ /**
128
+ * Show the status of the user in the status column
129
+ *
130
+ * @uses manage_users_custom_column
131
+ * @param string $val
132
+ * @param string $column_name
133
+ * @param int $user_id
134
+ * @return string
135
+ */
136
+ public function status_column( $val, $column_name, $user_id ) {
137
+ switch ( $column_name ) {
138
+ case 'pw_user_status' :
139
+ return pw_new_user_approve()->get_user_status( $user_id );
140
+ break;
141
+
142
+ default:
143
+ }
144
+
145
+ return $val;
146
+ }
147
+
148
+ /**
149
+ * Add a filter to the user table to filter by user status
150
+ *
151
+ * @uses restrict_manage_users
152
+ */
153
+ public function status_filter() {
154
+ $filter_button = submit_button( __( 'Filter', 'new-user-approve' ), 'button', 'pw-status-query-submit', false, array( 'id' => 'pw-status-query-submit' ) );
155
+ $filtered_status = (isset( $_GET['new_user_approve_filter'] ) ) ? esc_attr( $_GET['new_user_approve_filter'] ) : '';
156
+
157
+ ?>
158
+ <label class="screen-reader-text" for="new_user_approve_filter"><?php _e( 'View all users', 'new-user-approve' ); ?></label>
159
+ <select id="new_user_approve_filter" name="new_user_approve_filter" style="float: none; margin: 0 0 0 15px;">
160
+ <option value=""><?php _e( 'View all users', 'new-user-approve' ); ?></option>
161
+ <?php foreach ( pw_new_user_approve()->get_valid_statuses() as $status ) : ?>
162
+ <option value="<?php echo esc_attr( $status ); ?>"<?php selected( $status, $filtered_status ); ?>><?php echo esc_html( $status ); ?></option>
163
+ <?php endforeach; ?>
164
+ </select>
165
+ <?php echo apply_filters( 'new_user_approve_filter_button', $filter_button ); ?>
166
+ <style>
167
+ #pw-status-query-submit {
168
+ float: right;
169
+ margin: 2px 0 0 5px;
170
+ }
171
+ </style>
172
+ <?php
173
+ }
174
+
175
+ /**
176
+ * Modify the user query if the status filter is being used.
177
+ *
178
+ * @uses pre_user_query
179
+ * @param $query
180
+ */
181
+ public function filter_by_status( $query ) {
182
+ global $wpdb;
183
+
184
+ if ( !is_admin() )
185
+ return;
186
+
187
+ $screen = get_current_screen();
188
+ if ( 'users' != $screen->id )
189
+ return;
190
+
191
+ if ( isset( $_GET['new_user_approve_filter'] ) ) {
192
+ $filter = esc_attr( $_GET['new_user_approve_filter'] );
193
+
194
+ $query->query_from .= " INNER JOIN {$wpdb->usermeta} wp_usermeta ON ( {$wpdb->users}.ID = wp_usermeta.user_id )";
195
+
196
+ if ( 'approved' == $filter ) {
197
+ $query->query_fields = "DISTINCT SQL_CALC_FOUND_ROWS {$wpdb->users}.ID";
198
+ $query->query_from .= " LEFT JOIN {$wpdb->usermeta} AS mt1 ON ({$wpdb->users}.ID = mt1.user_id AND mt1.meta_key = 'pw_user_status')";
199
+ $query->query_where .= " AND ( ( wp_usermeta.meta_key = 'pw_user_status' AND CAST(wp_usermeta.meta_value AS CHAR) = 'approved' ) OR mt1.user_id IS NULL )";
200
+ } else {
201
+ $query->query_where .= " AND ( (wp_usermeta.meta_key = 'pw_user_status' AND CAST(wp_usermeta.meta_value AS CHAR) = '{$filter}') )";
202
+ }
203
+ }
204
+ }
205
+
206
+ /**
207
+ * Use javascript to add the ability to bulk modify the status of users.
208
+ *
209
+ * @uses admin_footer-users.php
210
+ */
211
+ public function admin_footer() {
212
+ $screen = get_current_screen();
213
+
214
+ if ( $screen->id == 'users' ) : ?>
215
+ <script type="text/javascript">
216
+ jQuery(document).ready(function($) {
217
+ $('<option>').val('approve').text('<?php _e( 'Approve', 'new-user-approve' )?>').appendTo("select[name='action']")
218
+ $('<option>').val('approve').text('<?php _e( 'Approve', 'new-user-approve' )?>').appendTo("select[name='action2']");
219
+
220
+ $('<option>').val('deny').text('<?php _e( 'Deny', 'new-user-approve' )?>').appendTo("select[name='action']")
221
+ $('<option>').val('deny').text('<?php _e( 'Deny', 'new-user-approve' )?>').appendTo("select[name='action2']");
222
+ });
223
+ </script>
224
+ <?php endif;
225
+ }
226
+
227
+ /**
228
+ * Process the bulk status updates
229
+ *
230
+ * @uses load-users.php
231
+ */
232
+ public function bulk_action() {
233
+ $screen = get_current_screen();
234
+
235
+ if ( $screen->id == 'users' ) {
236
+
237
+ // get the action
238
+ $wp_list_table = _get_list_table( 'WP_Users_List_Table' );
239
+ $action = $wp_list_table->current_action();
240
+
241
+ $allowed_actions = array( 'approve', 'deny' );
242
+ if ( !in_array( $action, $allowed_actions ) )
243
+ return;
244
+
245
+ // security check
246
+ check_admin_referer( 'bulk-users' );
247
+
248
+ // make sure ids are submitted
249
+ if ( isset( $_REQUEST['users'] ) ) {
250
+ $user_ids = array_map( 'intval', $_REQUEST['users'] );
251
+ }
252
+
253
+ if ( empty( $user_ids ) )
254
+ return;
255
+
256
+ $sendback = remove_query_arg( array( 'approved', 'denied', 'deleted', 'ids', 'new_user_approve_filter', 'pw-status-query-submit', 'new_role' ), wp_get_referer() );
257
+ if ( ! $sendback )
258
+ $sendback = admin_url( "users.php" );
259
+
260
+ $pagenum = $wp_list_table->get_pagenum();
261
+ $sendback = add_query_arg( 'paged', $pagenum, $sendback );
262
+
263
+ switch($action) {
264
+ case 'approve':
265
+ $approved = 0;
266
+ foreach( $user_ids as $user_id ) {
267
+ pw_new_user_approve()->update_user_status( $user_id, 'approve' );
268
+ $approved++;
269
+ }
270
+
271
+ $sendback = add_query_arg( array( 'approved' => $approved, 'ids' => join(',', $user_ids ) ), $sendback );
272
+ break;
273
+
274
+ case 'deny':
275
+ $denied = 0;
276
+ foreach( $user_ids as $user_id ) {
277
+ pw_new_user_approve()->update_user_status( $user_id, 'deny' );
278
+ $denied++;
279
+ }
280
+
281
+ $sendback = add_query_arg( array( 'denied' => $denied, 'ids' => join(',', $user_ids ) ), $sendback );
282
+ break;
283
+
284
+ default: return;
285
+ }
286
+
287
+ $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback );
288
+
289
+ wp_redirect( $sendback );
290
+ exit();
291
+ }
292
+ }
293
+
294
+ /**
295
+ * Show a message on the users page if a status has been updated.
296
+ *
297
+ * @uses admin_notices
298
+ */
299
+ public function admin_notices() {
300
+ $screen = get_current_screen();
301
+
302
+ if ( $screen->id != 'users' )
303
+ return;
304
+
305
+ $message = null;
306
+
307
+ if ( isset( $_REQUEST['denied'] ) && (int) $_REQUEST['denied']) {
308
+ $message = sprintf( _n( 'User denied.', '%s users denied.', $_REQUEST['denied'], 'new-user-approve' ), number_format_i18n( $_REQUEST['denied'] ) );
309
+ }
310
+
311
+ if ( isset( $_REQUEST['approved'] ) && (int) $_REQUEST['approved']) {
312
+ $message = sprintf( _n( 'User approved.', '%s users approved.', $_REQUEST['approved'], 'new-user-approve' ), number_format_i18n( $_REQUEST['approved'] ) );
313
+ }
314
+
315
+ if ( !empty( $message ) ) {
316
+ echo '<div class="updated"><p>' . $message . '</p></div>';
317
+ }
318
+ }
319
+
320
+ /**
321
+ * Display the dropdown on the user profile page to allow an admin to update the user status.
322
+ *
323
+ * @uses show_user_profile
324
+ * @uses edit_user_profile
325
+ * @param object $user
326
+ */
327
+ public function profile_status_field( $user ) {
328
+ if ( $user->ID == get_current_user_id() )
329
+ return;
330
+
331
+ $user_status = pw_new_user_approve()->get_user_status( $user->ID );
332
+ ?>
333
+ <table class="form-table">
334
+ <tr>
335
+ <th><label for="new_user_approve_status"><?php _e( 'Access Status', 'new-user-approve' ); ?></label></th>
336
+ <td>
337
+ <select id="new_user_approve_status" name="new_user_approve_status">
338
+ <?php if ( $user_status == 'pending' ) : ?>
339
+ <option value=""><?php _e( '-- Status --', 'new-user-approve' ); ?></option>
340
+ <?php endif; ?>
341
+ <?php foreach ( array( 'approved', 'denied' ) as $status ) : ?>
342
+ <option value="<?php echo esc_attr( $status ); ?>"<?php selected( $status, $user_status ); ?>><?php echo esc_html( $status ); ?></option>
343
+ <?php endforeach; ?>
344
+ </select>
345
+ <span class="description"><?php _e( 'If user has access to sign in or not.', 'new-user-approve' ); ?></span>
346
+ <?php if ( $user_status == 'pending' ) : ?>
347
+ <br /><span class="description"><?php _e( 'Current user status is <strong>pending</strong>.', 'new-user-approve' ); ?></span>
348
+ <?php endif; ?>
349
+ </td>
350
+ </tr>
351
+ </table>
352
+ <?php
353
+ }
354
+
355
+ /**
356
+ * Save the user status when updating from the user profile.
357
+ *
358
+ * @uses edit_user_profile_update
359
+ * @param int $user_id
360
+ * @return bool
361
+ */
362
+ public function save_profile_status_field( $user_id ) {
363
+ if ( !current_user_can( 'edit_user', $user_id ) )
364
+ return false;
365
+
366
+ if ( ! empty( $_POST['new_user_approve_status'] ) ) {
367
+ $new_status = esc_attr( $_POST['new_user_approve_status'] );
368
+
369
+ if ( $new_status == 'approved' )
370
+ $new_status = 'approve';
371
+ else if ( $new_status == 'denied' )
372
+ $new_status = 'deny';
373
+
374
+ pw_new_user_approve()->update_user_status( $user_id, $new_status );
375
+ }
376
+ }
377
+ }
378
+
379
+ function pw_new_user_approve_user_list() {
380
+ return pw_new_user_approve_user_list::instance();
381
+ }
382
+
383
+ pw_new_user_approve_user_list();
localization/new-user-approve-he_IL.mo ADDED
Binary file
localization/new-user-approve-he_IL.po ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR Josh Harrison
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: PACKAGE VERSION\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/new-user-approve\n"
10
+ "POT-Creation-Date: 2009-10-29 08:32+0000\n"
11
+ "PO-Revision-Date: 2013-07-28 17:08+0200\n"
12
+ "Last-Translator: Udi Burg <blog@udiburg.com>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Generator: Poedit 1.5.4\n"
18
+
19
+ #: new-user-approve.php:126
20
+ msgid "Approve New Users"
21
+ msgstr "אשר משתמשים חדשים"
22
+
23
+ #: new-user-approve.php:140
24
+ msgid "Settings"
25
+ msgstr "הגדרות"
26
+
27
+ #: new-user-approve.php:183
28
+ msgid "Users"
29
+ msgstr "משתמשים"
30
+
31
+ #: new-user-approve.php:219
32
+ msgid "User successfully updated."
33
+ msgstr "המשתמש עודכן בהצלחה."
34
+
35
+ #: new-user-approve.php:223
36
+ msgid "User Registration Approval"
37
+ msgstr "אישור רישום משתמש"
38
+
39
+ #: new-user-approve.php:225
40
+ msgid "User Management"
41
+ msgstr "ניהול משתמשים"
42
+
43
+ #: new-user-approve.php:228
44
+ msgid "Users Pending Approval"
45
+ msgstr "משתמשים המחכים לאישור"
46
+
47
+ #: new-user-approve.php:229
48
+ msgid "Approved Users"
49
+ msgstr "משתמשים מאושרים"
50
+
51
+ #: new-user-approve.php:230
52
+ msgid "Denied Users"
53
+ msgstr "משתמשים שנדחו"
54
+
55
+ #: new-user-approve.php:255
56
+ msgid "ID"
57
+ msgstr "ID"
58
+
59
+ #: new-user-approve.php:256
60
+ msgid "Username"
61
+ msgstr "שם משתמש"
62
+
63
+ #: new-user-approve.php:257
64
+ msgid "Name"
65
+ msgstr "שם"
66
+
67
+ #: new-user-approve.php:258
68
+ msgid "E-mail"
69
+ msgstr "אימייל"
70
+
71
+ #: new-user-approve.php:260 new-user-approve.php:262
72
+ msgid "Actions"
73
+ msgstr "פעולות"
74
+
75
+ #: new-user-approve.php:296
76
+ msgid "email:"
77
+ msgstr "אימייל:"
78
+
79
+ #: new-user-approve.php:298
80
+ msgid "Approve"
81
+ msgstr "מאושר"
82
+
83
+ #: new-user-approve.php:301
84
+ msgid "Deny"
85
+ msgstr "נדחה"
86
+
87
+ #: new-user-approve.php:313
88
+ msgid "approved"
89
+ msgstr "אושר"
90
+
91
+ #: new-user-approve.php:315
92
+ msgid "denied"
93
+ msgstr "נדחה"
94
+
95
+ #: new-user-approve.php:317
96
+ msgid "pending"
97
+ msgstr "ממתין לאישור"
98
+
99
+ #: new-user-approve.php:320
100
+ #, php-format
101
+ msgid "There are no users with a status of %s"
102
+ msgstr "אין משתמשים במצב %s"
103
+
104
+ #: new-user-approve.php:332
105
+ msgid "User name already exists"
106
+ msgstr "שם המשתמש כבר קיים"
107
+
108
+ #: new-user-approve.php:335
109
+ #, php-format
110
+ msgid "%1$s (%2$s) has requested a username at %3$s"
111
+ msgstr "%1$s (%2$s) כבר ביקש שם משתמש ב %3$s"
112
+
113
+ #: new-user-approve.php:337
114
+ #, php-format
115
+ msgid "To approve or deny this user access to %s go to"
116
+ msgstr "כדי לאשר או לדחות את המשתמש הזה כנסו ל %s go to"
117
+
118
+ #: new-user-approve.php:341
119
+ #, php-format
120
+ msgid "[%s] User Approval"
121
+ msgstr "[%s} אישור משתמש"
122
+
123
+ #: new-user-approve.php:372
124
+ #, php-format
125
+ msgid "You have been approved to access %s"
126
+ msgstr "אושרת להכנס ל %s"
127
+
128
+ #: new-user-approve.php:373
129
+ #, php-format
130
+ msgid "Username: %s"
131
+ msgstr "שם משתמש: %s"
132
+
133
+ #: new-user-approve.php:374
134
+ #, php-format
135
+ msgid "Password: %s"
136
+ msgstr "סיסמא: %s"
137
+
138
+ #: new-user-approve.php:378
139
+ #, php-format
140
+ msgid "[%s] Registration Approved"
141
+ msgstr "[%s] ההרשמה אושרה"
142
+
143
+ #: new-user-approve.php:397
144
+ #, php-format
145
+ msgid "You have been denied access to %s"
146
+ msgstr "בקשתך להכנס ל %s נדחתה"
147
+
148
+ #: new-user-approve.php:400
149
+ #, php-format
150
+ msgid "[%s] Registration Denied"
151
+ msgstr "[%s] הרשמה נדחתה"
152
+
153
+ #: new-user-approve.php:413
154
+ msgid ""
155
+ "An email has been sent to the site administrator. The administrator will "
156
+ "review the information that has been submitted and either approve or deny "
157
+ "your request."
158
+ msgstr ""
159
+ "נשלח אימייל למנהל האתר. מנהל האתר יעבור על המידע שנרשם על ידיכם ויחליט אם "
160
+ "לאשר או לדחות את בקשתכם."
161
+
162
+ #: new-user-approve.php:414
163
+ msgid ""
164
+ "You will receive an email with instructions on what you will need to do "
165
+ "next. Thanks for your patience."
166
+ msgstr ""
167
+ "אתם תקבלו אימייל עם הוראות לגבי מה עליכם לעשות בהמשך. תודה על סבלנותכם."
168
+
169
+ #: new-user-approve.php:418
170
+ msgid "Pending Approval"
171
+ msgstr "ממתין לאישור"
172
+
173
+ #: new-user-approve.php:418
174
+ msgid "Registration successful."
175
+ msgstr "ההרשמה הצליחה."
176
+
177
+ #: new-user-approve.php:466
178
+ #, php-format
179
+ msgid ""
180
+ "Welcome to %s. This site is accessible to approved users only. To be "
181
+ "approved, you must first register."
182
+ msgstr ""
183
+ "ברוכים הבאים ל %s. הכניסה לאתר למשתמשים מורשים בלבד. על מנת לקבל הרשאת כניסה "
184
+ "עליכם להרשם."
185
+
186
+ #: new-user-approve.php:471
187
+ msgid ""
188
+ "After you register, your request will be sent to the site administrator for "
189
+ "approval. You will then receive an email with further instructions."
190
+ msgstr ""
191
+ "אחרי שתרשמו בקשתכם תישלח למנהל האתר לצורך אישור. לאחר מכן תקבלו אימייל עם "
192
+ "הנחיות נוספות."
193
+
194
+ #. Plugin Name of an extension
195
+ msgid "New User Approve"
196
+ msgstr "אישור משתמש חדש"
197
+
198
+ #. Plugin URI of an extension
199
+ msgid "http://www.picklewagon.com/wordpress/new-user-approve"
200
+ msgstr "http://www.picklewagon.com/wordpress/new-user-approve"
201
+
202
+ #. Description of an extension
203
+ msgid ""
204
+ "This plugin allows administrators to approve users once they register. Only "
205
+ "approved users will be allowed to access the blog."
206
+ msgstr ""
207
+ "התוסף הזה מאפשר למנהלי האתר לאשר משתמשים שנרשמו. רק משתמשים מורשים יוכלו "
208
+ "להכנס לבלוג."
209
+
210
+ #. Author of an extension
211
+ msgid "Josh Harrison"
212
+ msgstr "Josh Harrison"
213
+
214
+ #. Author URI of an extension
215
+ msgid "http://www.picklewagon.com/"
216
+ msgstr "http://www.picklewagon.com/"
localization/new-user-approve-pt_BR.mo ADDED
Binary file
localization/new-user-approve-pt_BR.po ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: aprove\n"
4
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/new-user-approve\n"
5
+ "POT-Creation-Date: 2009-10-29 08:32+0000\n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: Leo Germani <leogermani@hacklab.com.br>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=utf-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-Language: Portuguese\n"
13
+ "X-Poedit-Country: BRAZIL\n"
14
+ "X-Poedit-SourceCharset: utf-8\n"
15
+
16
+ #: new-user-approve.php:126
17
+ msgid "Approve New Users"
18
+ msgstr "Aprovar novos usuários"
19
+
20
+ #: new-user-approve.php:140
21
+ msgid "Settings"
22
+ msgstr "Configurações"
23
+
24
+ #: new-user-approve.php:183
25
+ msgid "Users"
26
+ msgstr "Usuários"
27
+
28
+ #: new-user-approve.php:219
29
+ msgid "User successfully updated."
30
+ msgstr "Usuário atualizado com sucesso!"
31
+
32
+ #: new-user-approve.php:223
33
+ msgid "User Registration Approval"
34
+ msgstr "Aprovação de registro de usuários"
35
+
36
+ #: new-user-approve.php:225
37
+ msgid "User Management"
38
+ msgstr "Administração de usuários"
39
+
40
+ #: new-user-approve.php:228
41
+ msgid "Users Pending Approval"
42
+ msgstr "Usuários com aprovação pendente"
43
+
44
+ #: new-user-approve.php:229
45
+ msgid "Approved Users"
46
+ msgstr "Usuários aprovados"
47
+
48
+ #: new-user-approve.php:230
49
+ msgid "Denied Users"
50
+ msgstr "Usuários negados"
51
+
52
+ #: new-user-approve.php:255
53
+ msgid "ID"
54
+ msgstr ""
55
+
56
+ #: new-user-approve.php:256
57
+ msgid "Username"
58
+ msgstr "Username"
59
+
60
+ #: new-user-approve.php:257
61
+ msgid "Name"
62
+ msgstr "Nome"
63
+
64
+ #: new-user-approve.php:258
65
+ msgid "E-mail"
66
+ msgstr ""
67
+
68
+ #: new-user-approve.php:260
69
+ #: new-user-approve.php:262
70
+ msgid "Actions"
71
+ msgstr "Ações"
72
+
73
+ #: new-user-approve.php:296
74
+ msgid "email:"
75
+ msgstr ""
76
+
77
+ #: new-user-approve.php:298
78
+ msgid "Approve"
79
+ msgstr "Aprovar"
80
+
81
+ #: new-user-approve.php:301
82
+ msgid "Deny"
83
+ msgstr "Negar"
84
+
85
+ #: new-user-approve.php:313
86
+ msgid "approved"
87
+ msgstr "aprovado"
88
+
89
+ #: new-user-approve.php:315
90
+ msgid "denied"
91
+ msgstr "negado"
92
+
93
+ #: new-user-approve.php:317
94
+ msgid "pending"
95
+ msgstr "pendente"
96
+
97
+ #: new-user-approve.php:320
98
+ #, php-format
99
+ msgid "There are no users with a status of %s"
100
+ msgstr "Não há usuários com o status %s "
101
+
102
+ #: new-user-approve.php:332
103
+ msgid "User name already exists"
104
+ msgstr "Nome de usuário já existe"
105
+
106
+ #: new-user-approve.php:335
107
+ #, php-format
108
+ msgid "%1$s (%2$s) has requested a username at %3$s"
109
+ msgstr "%1$s (%2$s) requisitou um nome de usuário em %3$s"
110
+
111
+ #: new-user-approve.php:337
112
+ #, php-format
113
+ msgid "To approve or deny this user access to %s go to"
114
+ msgstr "Para aprovar ou negar o acesso deste usuário a %s vá para"
115
+
116
+ #: new-user-approve.php:341
117
+ #, php-format
118
+ msgid "[%s] User Approval"
119
+ msgstr "[%s] Aprovação de usuário"
120
+
121
+ #: new-user-approve.php:372
122
+ #, php-format
123
+ msgid "You have been approved to access %s"
124
+ msgstr "Seu acesso a %s foi aprovado"
125
+
126
+ #: new-user-approve.php:373
127
+ #, php-format
128
+ msgid "Username: %s"
129
+ msgstr "Username: %s"
130
+
131
+ #: new-user-approve.php:374
132
+ #, php-format
133
+ msgid "Password: %s"
134
+ msgstr "Senha: %s"
135
+
136
+ #: new-user-approve.php:378
137
+ #, php-format
138
+ msgid "[%s] Registration Approved"
139
+ msgstr "[%s] Registro aprovado"
140
+
141
+ #: new-user-approve.php:397
142
+ #, php-format
143
+ msgid "You have been denied access to %s"
144
+ msgstr "Seu acesso a %s foi negado"
145
+
146
+ #: new-user-approve.php:400
147
+ #, php-format
148
+ msgid "[%s] Registration Denied"
149
+ msgstr "[%s] Registro negado"
150
+
151
+ #: new-user-approve.php:413
152
+ msgid "An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request."
153
+ msgstr "Um e-mail foi enviado ao administrador do site. Ele(a) irá revisar suas informações e então aprovar ou não o seu pedido."
154
+
155
+ #: new-user-approve.php:414
156
+ msgid "You will receive an email with instructions on what you will need to do next. Thanks for your patience."
157
+ msgstr "Você receberá um e-mail com instruções do que fazer em seguida. Obrigado pela paciência."
158
+
159
+ #: new-user-approve.php:418
160
+ msgid "Pending Approval"
161
+ msgstr "Aprovação pendente"
162
+
163
+ #: new-user-approve.php:418
164
+ msgid "Registration successful."
165
+ msgstr "Registro bem sucedido."
166
+
167
+ #: new-user-approve.php:466
168
+ #, php-format
169
+ msgid "Welcome to %s. This site is accessible to approved users only. To be approved, you must first register."
170
+ msgstr "Benvindo a %s. Este site é acessível apenas a usuários aprovados. Para ser aprovado, você precisa primeiro se registrar."
171
+
172
+ #: new-user-approve.php:471
173
+ msgid "After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions."
174
+ msgstr "Depois de se registrar, seu pedido será enviado ao administrador do site para aprovação. Você receberá então um e-mail com mais instruções."
175
+
176
+ #. Plugin Name of an extension
177
+ msgid "New User Approve"
178
+ msgstr "Έγκριση Νέου Χρήστη"
179
+
180
+ #. Plugin URI of an extension
181
+ msgid "http://www.picklewagon.com/wordpress/new-user-approve"
182
+ msgstr ""
183
+
184
+ #. Description of an extension
185
+ msgid "This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog."
186
+ msgstr ""
187
+
188
+ #. Author of an extension
189
+ msgid "Josh Harrison"
190
+ msgstr ""
191
+
192
+ #. Author URI of an extension
193
+ msgid "http://www.picklewagon.com/"
194
+ msgstr ""
195
+
localization/new-user-approve-sk_SK.mo ADDED
Binary file
localization/new-user-approve-sk_SK.po ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) YEAR Josh Harrison
2
+ # This file is distributed under the same license as the new-user-approve.1.4.2.zip package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: new-user-approve.1.4.2\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/new-user-approve\n"
7
+ "POT-Creation-Date: 2013-04-03 12:03:27+01:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2013-04-09 09:25:00+01:00\n"
12
+ "Last-Translator: Boris Gereg <qwerty@elusion.sk>\n"
13
+ "Language-Team: Boris Gereg <qwerty@elusion.sk>\n"
14
+ "Language: SK\n"
15
+ "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
16
+
17
+ #: new-user-approve.php:126
18
+ msgid "Approve New Users"
19
+ msgstr ""
20
+ "Schváliť nových používateľov"
21
+
22
+ #: new-user-approve.php:140
23
+ msgid "Settings"
24
+ msgstr ""
25
+ "Nastavenia"
26
+
27
+ #: new-user-approve.php:183
28
+ msgid "Users"
29
+ msgstr ""
30
+ "Používatelia"
31
+
32
+ #: new-user-approve.php:219
33
+ msgid "User successfully updated."
34
+ msgstr ""
35
+ "Používateľ sa úspešne aktualizoval."
36
+
37
+ #: new-user-approve.php:223
38
+ msgid "User Registration Approval"
39
+ msgstr ""
40
+ "Schválenie registrácie používateľa"
41
+
42
+ #: new-user-approve.php:225
43
+ msgid "User Management"
44
+ msgstr ""
45
+ "Manažment používateľov"
46
+
47
+ #: new-user-approve.php:228
48
+ msgid "Users Pending Approval"
49
+ msgstr ""
50
+ "Používatelia čakajúci na schválenie"
51
+
52
+ #: new-user-approve.php:229
53
+ msgid "Approved Users"
54
+ msgstr ""
55
+ "Schválení používatelia"
56
+
57
+ #: new-user-approve.php:230
58
+ msgid "Denied Users"
59
+ msgstr ""
60
+ "Zamietnutí používatelia"
61
+
62
+ #: new-user-approve.php:255
63
+ msgid "ID"
64
+ msgstr ""
65
+ "ID"
66
+
67
+ #: new-user-approve.php:256
68
+ msgid "Username"
69
+ msgstr ""
70
+ "Meno používateľa"
71
+
72
+ #: new-user-approve.php:257
73
+ msgid "Name"
74
+ msgstr ""
75
+ "Meno"
76
+
77
+ #: new-user-approve.php:258
78
+ msgid "E-mail"
79
+ msgstr ""
80
+ "E-mailová adresa"
81
+
82
+ #: new-user-approve.php:260 new-user-approve.php:262
83
+ msgid "Actions"
84
+ msgstr ""
85
+ "Akcia"
86
+
87
+ #: new-user-approve.php:296
88
+ msgid "email:"
89
+ msgstr ""
90
+ "E-mailová adresa:"
91
+
92
+ #: new-user-approve.php:298
93
+ msgid "Approve"
94
+ msgstr ""
95
+ "Schváliť"
96
+
97
+ #: new-user-approve.php:301
98
+ msgid "Deny"
99
+ msgstr ""
100
+ "Zamietnuť"
101
+
102
+ #: new-user-approve.php:313
103
+ msgid "approved"
104
+ msgstr ""
105
+ "„schválený“"
106
+
107
+ #: new-user-approve.php:315
108
+ msgid "denied"
109
+ msgstr ""
110
+ "„zamietnutý“"
111
+
112
+ #: new-user-approve.php:317
113
+ msgid "pending"
114
+ msgstr ""
115
+ "„čaká na schválenie“"
116
+
117
+ #: new-user-approve.php:320
118
+ #, php-format
119
+ msgid "There are no users with a status of %s"
120
+ msgstr ""
121
+ "Žiadni používatelia so stavom %s"
122
+
123
+ #: new-user-approve.php:332
124
+ msgid "User name already exists"
125
+ msgstr ""
126
+ "Meno používateľa už existuje"
127
+
128
+ #: new-user-approve.php:335
129
+ #, php-format
130
+ msgid "%1$s (%2$s) has requested a username at %3$s"
131
+ msgstr ""
132
+ "Návštevník %1$s (%2$s) požiadal o registráciu mena používateľa na lokalite „%3$s“."
133
+
134
+ #: new-user-approve.php:337
135
+ #, php-format
136
+ msgid "To approve or deny this user access to %s go to"
137
+ msgstr ""
138
+ "Ak chcete schváliť alebo zamietnuť prístup tohto používateľa k lokalite „%s“, prejdite na stránku"
139
+
140
+ #: new-user-approve.php:341
141
+ #, php-format
142
+ msgid "[%s] User Approval"
143
+ msgstr ""
144
+ "[%s] Schválenie používateľa"
145
+
146
+ #: new-user-approve.php:372
147
+ #, php-format
148
+ msgid "You have been approved to access %s"
149
+ msgstr ""
150
+ "Váš prístup k lokalite „%s“ bol schválený."
151
+
152
+ #: new-user-approve.php:373
153
+ #, php-format
154
+ msgid "Username: %s"
155
+ msgstr ""
156
+ "Meno používateľa: %s"
157
+
158
+ #: new-user-approve.php:374
159
+ #, php-format
160
+ msgid "Password: %s"
161
+ msgstr ""
162
+ "Heslo: %s"
163
+
164
+ #: new-user-approve.php:378
165
+ #, php-format
166
+ msgid "[%s] Registration Approved"
167
+ msgstr ""
168
+ "[%s] Schválenie registrácie"
169
+
170
+ #: new-user-approve.php:397
171
+ #, php-format
172
+ msgid "You have been denied access to %s"
173
+ msgstr ""
174
+ "Váš prístup k lokalite „%s“ bol zamietnutý."
175
+
176
+ #: new-user-approve.php:400
177
+ #, php-format
178
+ msgid "[%s] Registration Denied"
179
+ msgstr ""
180
+ "[%s] Zamietnutie registrácie"
181
+
182
+ #: new-user-approve.php:413
183
+ msgid "An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request."
184
+ msgstr ""
185
+ "Administrátorovi lokality sa odoslal e-mail. Administrátor si prezrie poskytnuté informácie a vašu požiadavku buď schváli, alebo zamietne."
186
+
187
+ #: new-user-approve.php:414
188
+ msgid "You will receive an email with instructions on what you will need to do next. Thanks for your patience."
189
+ msgstr ""
190
+ "Dostanete e-mail s pokynmi, ako postupovať ďalej. Ďakujeme vám za trpezlivosť."
191
+
192
+ #: new-user-approve.php:418
193
+ msgid "Pending Approval"
194
+ msgstr ""
195
+ "Čaká na schválenie"
196
+
197
+ #: new-user-approve.php:418
198
+ msgid "Registration successful."
199
+ msgstr ""
200
+ "Registrácia bola úspešná."
201
+
202
+ #: new-user-approve.php:466
203
+ #, php-format
204
+ msgid "Welcome to %s. This site is accessible to approved users only. To be approved, you must first register."
205
+ msgstr ""
206
+ "Vitajte na lokalite „%s“. Táto lokalita je prístupná iba schváleným používateľom. Schválenie sa dá vykonať až po vašej registrácii."
207
+
208
+ #: new-user-approve.php:471
209
+ msgid "After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions."
210
+ msgstr ""
211
+ "Po zaregistrovaní sa administrátorovi lokality odošle vaša požiadavka o schválenie. Po jej spracovaní dostanete e-mail s ďalšími pokynmi."
212
+
213
+ #. Plugin Name of an extension
214
+ msgid "New User Approve"
215
+ msgstr ""
216
+ "Schválenie nového používateľa"
217
+
218
+ #. Plugin URI of an extension
219
+ msgid "http://www.picklewagon.com/wordpress/new-user-approve"
220
+ msgstr ""
221
+ "http://www.picklewagon.com/wordpress/new-user-approve"
222
+
223
+ #. Description of an extension
224
+ msgid "This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog."
225
+ msgstr ""
226
+ "Tento modul umožňuje administrátorom schváliť používateľov po ich registrácii. Prístup k blogu získajú iba schválení používatelia."
227
+
228
+ #. Author of an extension
229
+ msgid "Josh Harrison"
230
+ msgstr ""
231
+ "Josh Harrison"
232
+
233
+ #. Author URI of an extension
234
+ msgid "http://www.picklewagon.com/"
235
+ msgstr ""
236
+ "http://www.picklewagon.com/"
localization/new-user-approve.pot CHANGED
@@ -1,207 +1,248 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR Josh Harrison
3
- # This file is distributed under the same license as the PACKAGE package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
  #
6
- #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/new-user-approve\n"
11
- "POT-Creation-Date: 2009-10-29 08:32+0000\n"
12
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
 
15
  "MIME-Version: 1.0\n"
16
- "Content-Type: text/plain; charset=CHARSET\n"
17
  "Content-Transfer-Encoding: 8bit\n"
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- #: new-user-approve.php:126
20
- msgid "Approve New Users"
21
  msgstr ""
22
 
23
- #: new-user-approve.php:140
24
- msgid "Settings"
 
25
  msgstr ""
26
 
27
- #: new-user-approve.php:183
28
  msgid "Users"
29
  msgstr ""
30
 
31
- #: new-user-approve.php:219
32
- msgid "User successfully updated."
 
33
  msgstr ""
34
 
35
- #: new-user-approve.php:223
36
- msgid "User Registration Approval"
 
37
  msgstr ""
38
 
39
- #: new-user-approve.php:225
40
- msgid "User Management"
 
41
  msgstr ""
42
 
43
- #: new-user-approve.php:228
44
- msgid "Users Pending Approval"
 
 
 
45
  msgstr ""
46
 
47
- #: new-user-approve.php:229
48
- msgid "Approved Users"
 
49
  msgstr ""
50
 
51
- #: new-user-approve.php:230
52
- msgid "Denied Users"
 
53
  msgstr ""
54
 
55
- #: new-user-approve.php:255
56
- msgid "ID"
 
57
  msgstr ""
58
 
59
- #: new-user-approve.php:256
60
- msgid "Username"
 
61
  msgstr ""
62
 
63
- #: new-user-approve.php:257
64
- msgid "Name"
 
65
  msgstr ""
66
 
67
- #: new-user-approve.php:258
68
- msgid "E-mail"
 
69
  msgstr ""
70
 
71
- #: new-user-approve.php:260 new-user-approve.php:262
72
- msgid "Actions"
 
 
 
73
  msgstr ""
74
 
75
- #: new-user-approve.php:296
76
- msgid "email:"
 
 
77
  msgstr ""
78
 
79
- #: new-user-approve.php:298
80
- msgid "Approve"
81
  msgstr ""
82
 
83
- #: new-user-approve.php:301
84
- msgid "Deny"
85
  msgstr ""
86
 
87
- #: new-user-approve.php:313
88
- msgid "approved"
 
 
 
89
  msgstr ""
90
 
91
- #: new-user-approve.php:315
92
- msgid "denied"
 
 
93
  msgstr ""
94
 
95
- #: new-user-approve.php:317
96
- msgid "pending"
97
  msgstr ""
98
 
99
- #: new-user-approve.php:320
100
- #, php-format
101
- msgid "There are no users with a status of %s"
102
  msgstr ""
103
 
104
- #: new-user-approve.php:332
105
- msgid "User name already exists"
106
  msgstr ""
107
 
108
- #: new-user-approve.php:335
109
- #, php-format
110
- msgid "%1$s (%2$s) has requested a username at %3$s"
111
  msgstr ""
112
 
113
- #: new-user-approve.php:337
114
- #, php-format
115
- msgid "To approve or deny this user access to %s go to"
116
  msgstr ""
117
 
118
- #: new-user-approve.php:341
119
- #, php-format
120
- msgid "[%s] User Approval"
121
  msgstr ""
122
 
123
- #: new-user-approve.php:372
124
- #, php-format
125
- msgid "You have been approved to access %s"
126
  msgstr ""
127
 
128
- #: new-user-approve.php:373
129
- #, php-format
130
- msgid "Username: %s"
131
  msgstr ""
132
 
133
- #: new-user-approve.php:374
134
- #, php-format
135
- msgid "Password: %s"
136
  msgstr ""
137
 
138
- #: new-user-approve.php:378
139
- #, php-format
140
- msgid "[%s] Registration Approved"
141
  msgstr ""
142
 
143
- #: new-user-approve.php:397
144
- #, php-format
145
- msgid "You have been denied access to %s"
146
  msgstr ""
147
 
148
- #: new-user-approve.php:400
149
- #, php-format
150
- msgid "[%s] Registration Denied"
151
  msgstr ""
152
 
153
- #: new-user-approve.php:413
154
- msgid ""
155
- "An email has been sent to the site administrator. The administrator will "
156
- "review the information that has been submitted and either approve or deny "
157
- "your request."
158
  msgstr ""
159
 
160
- #: new-user-approve.php:414
161
- msgid ""
162
- "You will receive an email with instructions on what you will need to do "
163
- "next. Thanks for your patience."
164
  msgstr ""
165
 
166
- #: new-user-approve.php:418
167
- msgid "Pending Approval"
168
  msgstr ""
169
 
170
- #: new-user-approve.php:418
171
- msgid "Registration successful."
172
  msgstr ""
173
 
174
- #: new-user-approve.php:466
175
  #, php-format
176
- msgid ""
177
- "Welcome to %s. This site is accessible to approved users only. To be "
178
- "approved, you must first register."
179
  msgstr ""
180
 
181
- #: new-user-approve.php:471
 
182
  msgid ""
183
- "After you register, your request will be sent to the site administrator for "
184
- "approval. You will then receive an email with further instructions."
185
  msgstr ""
186
 
187
- #. Plugin Name of an extension
188
- msgid "New User Approve"
189
  msgstr ""
190
 
191
- #. Plugin URI of an extension
192
- msgid "http://www.picklewagon.com/wordpress/new-user-approve"
193
  msgstr ""
194
 
195
- #. Description of an extension
196
- msgid ""
197
- "This plugin allows administrators to approve users once they register. Only "
198
- "approved users will be allowed to access the blog."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  msgstr ""
200
 
201
- #. Author of an extension
202
- msgid "Josh Harrison"
203
  msgstr ""
204
 
205
- #. Author URI of an extension
206
- msgid "http://www.picklewagon.com/"
207
  msgstr ""
1
+ # New User Approve WordPress plugin
2
+ # Copyright (C) 2013 Josh Harrison
3
+ # This file is distributed under the same license as the parent package.
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
  #
 
6
  msgid ""
7
  msgstr ""
8
+ "Project-Id-Version: New User Approve\n"
9
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/new-user-approve\n"
10
+ "POT-Creation-Date: 2013-08-20 21:48-0700\n"
11
+ "PO-Revision-Date: 2013-08-20 21:53-0700\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: Picklewagon <josh@picklewagon.com>\n"
14
+ "Language: English\n"
15
  "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
19
+ "X-Generator: Poedit 1.5.7\n"
20
+ "X-Poedit-SourceCharset: UTF-8\n"
21
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
22
+ "X-Poedit-Basepath: .\n"
23
+ "X-Poedit-SearchPath-0: ..\n"
24
+ "X-Poedit-SearchPath-1: ../includes\n"
25
+
26
+ #: ../new-user-approve.php:79
27
+ #, php-format
28
+ msgid "New User Approve requires WordPress %s or newer."
29
+ msgstr ""
30
 
31
+ #: ../new-user-approve.php:204
32
+ msgid "<strong>ERROR</strong>: Your account is still pending approval."
33
  msgstr ""
34
 
35
+ #: ../new-user-approve.php:210
36
+ msgid ""
37
+ "<strong>ERROR</strong>: Your account has been denied access to this site."
38
  msgstr ""
39
 
40
+ #: ../new-user-approve.php:297
41
  msgid "Users"
42
  msgstr ""
43
 
44
+ #: ../new-user-approve.php:325
45
+ #, php-format
46
+ msgid "%1$s (%2$s) has requested a username at %3$s"
47
  msgstr ""
48
 
49
+ #: ../new-user-approve.php:327
50
+ #, php-format
51
+ msgid "To approve or deny this user access to %s go to"
52
  msgstr ""
53
 
54
+ #: ../new-user-approve.php:332
55
+ #, php-format
56
+ msgid "[%s] User Approval"
57
  msgstr ""
58
 
59
+ #: ../new-user-approve.php:359
60
+ #, php-format
61
+ msgid ""
62
+ "<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a "
63
+ "href=\"mailto:%s\">webmaster</a> !"
64
  msgstr ""
65
 
66
+ #: ../new-user-approve.php:429
67
+ #, php-format
68
+ msgid "You have been approved to access %s"
69
  msgstr ""
70
 
71
+ #: ../new-user-approve.php:430
72
+ #, php-format
73
+ msgid "Username: %s"
74
  msgstr ""
75
 
76
+ #: ../new-user-approve.php:432
77
+ #, php-format
78
+ msgid "Password: %s"
79
  msgstr ""
80
 
81
+ #: ../new-user-approve.php:438
82
+ #, php-format
83
+ msgid "[%s] Registration Approved"
84
  msgstr ""
85
 
86
+ #: ../new-user-approve.php:462
87
+ #, php-format
88
+ msgid "You have been denied access to %s"
89
  msgstr ""
90
 
91
+ #: ../new-user-approve.php:465
92
+ #, php-format
93
+ msgid "[%s] Registration Denied"
94
  msgstr ""
95
 
96
+ #: ../new-user-approve.php:511
97
+ msgid ""
98
+ "An email has been sent to the site administrator. The administrator will "
99
+ "review the information that has been submitted and either approve or deny "
100
+ "your request."
101
  msgstr ""
102
 
103
+ #: ../new-user-approve.php:513
104
+ msgid ""
105
+ "You will receive an email with instructions on what you will need to do "
106
+ "next. Thanks for your patience."
107
  msgstr ""
108
 
109
+ #: ../new-user-approve.php:518
110
+ msgid "Registration successful."
111
  msgstr ""
112
 
113
+ #: ../new-user-approve.php:521
114
+ msgid "Pending Approval"
115
  msgstr ""
116
 
117
+ #: ../new-user-approve.php:558
118
+ #, php-format
119
+ msgid ""
120
+ "Welcome to %s. This site is accessible to approved users only. To be "
121
+ "approved, you must first register."
122
  msgstr ""
123
 
124
+ #: ../new-user-approve.php:567
125
+ msgid ""
126
+ "After you register, your request will be sent to the site administrator for "
127
+ "approval. You will then receive an email with further instructions."
128
  msgstr ""
129
 
130
+ #: ../includes/admin-approve.php:49
131
+ msgid "Approve New Users"
132
  msgstr ""
133
 
134
+ #: ../includes/admin-approve.php:58
135
+ msgid "User successfully updated."
 
136
  msgstr ""
137
 
138
+ #: ../includes/admin-approve.php:64
139
+ msgid "User Registration Approval"
140
  msgstr ""
141
 
142
+ #: ../includes/admin-approve.php:67
143
+ msgid "Users Pending Approval"
 
144
  msgstr ""
145
 
146
+ #: ../includes/admin-approve.php:68
147
+ msgid "Approved Users"
 
148
  msgstr ""
149
 
150
+ #: ../includes/admin-approve.php:69
151
+ msgid "Denied Users"
 
152
  msgstr ""
153
 
154
+ #: ../includes/admin-approve.php:108
155
+ msgid "Username"
 
156
  msgstr ""
157
 
158
+ #: ../includes/admin-approve.php:109
159
+ msgid "Name"
 
160
  msgstr ""
161
 
162
+ #: ../includes/admin-approve.php:110
163
+ msgid "E-mail"
 
164
  msgstr ""
165
 
166
+ #: ../includes/admin-approve.php:112 ../includes/admin-approve.php:114
167
+ msgid "Actions"
 
168
  msgstr ""
169
 
170
+ #: ../includes/admin-approve.php:149
171
+ msgid "email:"
 
172
  msgstr ""
173
 
174
+ #: ../includes/admin-approve.php:151 ../includes/user-list.php:95
175
+ #: ../includes/user-list.php:217 ../includes/user-list.php:218
176
+ msgid "Approve"
177
  msgstr ""
178
 
179
+ #: ../includes/admin-approve.php:154 ../includes/user-list.php:96
180
+ #: ../includes/user-list.php:220 ../includes/user-list.php:221
181
+ msgid "Deny"
 
 
182
  msgstr ""
183
 
184
+ #: ../includes/admin-approve.php:169
185
+ msgid "approved"
 
 
186
  msgstr ""
187
 
188
+ #: ../includes/admin-approve.php:171
189
+ msgid "denied"
190
  msgstr ""
191
 
192
+ #: ../includes/admin-approve.php:173
193
+ msgid "pending"
194
  msgstr ""
195
 
196
+ #: ../includes/admin-approve.php:176
197
  #, php-format
198
+ msgid "There are no users with a status of %s"
 
 
199
  msgstr ""
200
 
201
+ #: ../includes/admin-approve.php:212
202
+ #, php-format
203
  msgid ""
204
+ "You can now update user status on the <a href=\"%1$s\">users admin page</a>. "
205
+ "| <a href=\"%2$s\">Hide Notice</a>"
206
  msgstr ""
207
 
208
+ #: ../includes/user-list.php:118
209
+ msgid "Status"
210
  msgstr ""
211
 
212
+ #: ../includes/user-list.php:154
213
+ msgid "Filter"
214
  msgstr ""
215
 
216
+ #: ../includes/user-list.php:158 ../includes/user-list.php:160
217
+ msgid "View all users"
218
+ msgstr ""
219
+
220
+ #: ../includes/user-list.php:308
221
+ #, php-format
222
+ msgid "User denied."
223
+ msgid_plural "%s users denied."
224
+ msgstr[0] ""
225
+ msgstr[1] ""
226
+
227
+ #: ../includes/user-list.php:312
228
+ #, php-format
229
+ msgid "User approved."
230
+ msgid_plural "%s users approved."
231
+ msgstr[0] ""
232
+ msgstr[1] ""
233
+
234
+ #: ../includes/user-list.php:335
235
+ msgid "Access Status"
236
+ msgstr ""
237
+
238
+ #: ../includes/user-list.php:339
239
+ msgid "-- Status --"
240
  msgstr ""
241
 
242
+ #: ../includes/user-list.php:345
243
+ msgid "If user has access to sign in or not."
244
  msgstr ""
245
 
246
+ #: ../includes/user-list.php:347
247
+ msgid "Current user status is <strong>pending</strong>."
248
  msgstr ""
new-user-approve.php CHANGED
@@ -2,573 +2,599 @@
2
  /*
3
  Plugin Name: New User Approve
4
  Plugin URI: http://www.picklewagon.com/wordpress/new-user-approve/
5
- Description: This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
6
  Author: Josh Harrison
7
- Version: 1.4.2
8
  Author URI: http://www.picklewagon.com/
9
  */
10
 
11
- /** Copyright 2009
12
- This program is free software; you can redistribute it and/or modify
13
- it under the terms of the GNU General Public License as published by
14
- the Free Software Foundation; either version 2 of the License, or
15
- (at your option) any later version.
16
-
17
- This program is distributed in the hope that it will be useful,
18
- but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- GNU General Public License for more details.
21
-
22
- You should have received a copy of the GNU General Public License
23
- along with this program; if not, write to the Free Software
24
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
- */
26
-
27
- if ( ! class_exists( 'pw_new_user_approve' ) ) {
28
  class pw_new_user_approve {
29
- /**
30
- * @var string $plugin_id unique identifier used for localization and other functions
31
- */
32
- var $plugin_id = 'new-user-approve';
33
-
34
- var $_admin_page = 'new-user-approve-admin';
35
-
36
- // Class Functions
37
- /**
38
- * PHP 4 Compatible Constructor
39
- */
40
- public function pw_new_user_approve() {
41
- $this->__construct();
42
- }
43
 
44
- /**
45
- * PHP 5 Constructor
46
- */
47
- public function __construct() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  // Load up the localization file if we're using WordPress in a different language
49
  // Just drop it in this plugin's "localization" folder and name it "new-user-approve-[value in wp-config].mo"
50
- load_plugin_textdomain( $this->plugin_id, false, dirname( plugin_basename( __FILE__ ) ) . '/localization' );
51
-
52
- register_activation_hook( __FILE__, array( $this, 'activation_check' ) );
53
-
54
- // Actions
55
- add_action( 'admin_menu', array( $this, 'admin_menu_link' ) );
56
- add_action( 'admin_footer', array( $this, 'admin_scripts_footer' ) );
57
- add_action( 'init', array( $this, 'init' ) );
58
- add_action( 'init', array( $this, 'process_input' ) );
59
- add_action( 'register_post', array( $this, 'send_approval_email' ), 10, 3 );
60
- add_action( 'lostpassword_post', array( $this, 'lost_password' ) );
61
- add_action( 'user_register', array( $this, 'add_user_status' ) );
62
- add_action( 'new_user_approve_approve_user', array( $this, 'approve_user' ) );
63
- add_action( 'new_user_approve_deny_user', array( $this, 'deny_user' ) );
64
- add_action( 'rightnow_end', array( $this, 'dashboard_stats' ) );
65
- add_action( 'user_register', array( $this, 'delete_new_user_approve_transient' ), 11 );
66
- add_action( 'new_user_approve_approve_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
67
- add_action( 'new_user_approve_deny_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
68
- add_action( 'deleted_user', array( $this, 'delete_new_user_approve_transient' ) );
69
-
70
- // Filters
71
- add_filter( 'registration_errors', array( $this, 'show_user_pending_message' ), 10, 1 );
72
- add_filter( 'login_message', array( $this, 'welcome_user' ) );
73
- add_filter( 'wp_authenticate_user', array( $this, 'authenticate_user' ), 10, 2 );
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
  /**
77
- * Require WordPress 3.2.1 on activation
78
  *
79
  * @uses register_activation_hook
80
  */
81
- public function activation_check() {
82
  global $wp_version;
83
 
84
- $min_wp_version = '3.2.1';
85
- $exit_msg = sprintf( __( 'New User Approve requires WordPress %s or newer.', $this->plugin_id ), $min_wp_version );
86
  if ( version_compare( $wp_version, $min_wp_version, '<=' ) ) {
87
  exit( $exit_msg );
88
  }
89
- }
90
-
91
- /**
92
- * Enqueue any javascript and css needed for the plugin
93
- */
94
- public function init() {
95
- if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == $this->_admin_page ) {
96
- wp_enqueue_script( 'jquery-ui-tabs' );
97
- wp_enqueue_style( 'pw-admin-ui-tabs', plugins_url( 'ui.tabs.css', __FILE__ ) );
98
- }
99
- }
100
-
101
- /**
102
- * Add the new menu item to the users portion of the admin menu
103
- */
104
- function admin_menu_link() {
105
- $cap = apply_filters( 'new_user_approve_minimum_cap', 'edit_users' );
106
- $this->user_page_hook = add_users_page( __( 'Approve New Users', $this->plugin_id ), __( 'Approve New Users', $this->plugin_id ), $cap, $this->_admin_page, array( $this, 'approve_admin' ) );
107
- }
108
-
109
- /**
110
- * Output the javascript in the footer to display the tabs
111
- */
112
- public function admin_scripts_footer() {
113
- global $wp_db_version;
114
-
115
- if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == $this->_admin_page ) {
116
- $page_id = ( $wp_db_version >= 10851 ) ? '#pw_approve_tabs' : '#pw_approve_tabs > ul';
117
- ?>
118
- <script type="text/javascript">
119
- //<![CDATA[
120
- jQuery(document).ready(function($) {
121
- $('<?php echo $page_id; ?>').tabs({ fx: { opacity: 'toggle' } });
122
- });
123
- //]]>
124
- </script>
125
- <?php
126
- }
127
- }
128
-
129
- public function dashboard_stats() {
130
- $user_status = $this->get_user_statuses();
131
- ?>
132
- <div>
133
- <p><span style="font-weight:bold;"><a href="users.php?page=<?php print $this->_admin_page ?>"><?php _e( 'Users', $this->plugin_id ); ?></a></span>:
134
- <?php foreach ( $user_status as $status => $users ) print count( $users ) . " $status&nbsp;&nbsp;&nbsp;"; ?>
135
- </p>
136
- </div>
137
- <?php
138
- }
139
-
140
- /**
141
- * Create the view for the admin interface
142
- */
143
- public function approve_admin() {
144
- if ( isset( $_GET['user'] ) && isset( $_GET['status'] ) ) {
145
- echo '<div id="message" class="updated fade"><p>'.__( 'User successfully updated.', $this->plugin_id ).'</p></div>';
146
- }
147
- ?>
148
- <div class="wrap">
149
- <h2><?php _e( 'User Registration Approval', $this->plugin_id ); ?></h2>
150
-
151
- <h3><?php _e( 'User Management', $this->plugin_id ); ?></h3>
152
- <div id="pw_approve_tabs">
153
- <ul>
154
- <li><a href="#pw_pending_users"><span><?php _e( 'Users Pending Approval', $this->plugin_id ); ?></span></a></li>
155
- <li><a href="#pw_approved_users"><span><?php _e( 'Approved Users', $this->plugin_id ); ?></span></a></li>
156
- <li><a href="#pw_denied_users"><span><?php _e( 'Denied Users', $this->plugin_id ); ?></span></a></li>
157
- </ul>
158
- <div id="pw_pending_users">
159
- <?php $this->user_table( 'pending' ); ?>
160
- </div>
161
- <div id="pw_approved_users">
162
- <?php $this->user_table( 'approved' ); ?>
163
- </div>
164
- <div id="pw_denied_users">
165
- <?php $this->user_table( 'denied' ); ?>
166
- </div>
167
- </div>
168
- </div>
169
- <?php
170
- }
171
-
172
- /**
173
- * Output the table that shows the registered users grouped by status
174
- *
175
- * @param string $status the filter to use for which the users will be queried. Possible values are pending, approved, or denied.
176
- */
177
- public function user_table( $status ) {
178
- global $current_user;
179
-
180
- $approve = ( 'denied' == $status || 'pending' == $status );
181
- $deny = ( 'approved' == $status || 'pending' == $status );
182
 
183
- $user_status = $this->get_user_statuses();
184
- $users = $user_status[$status];
185
-
186
- if ( count( $users ) > 0 ) {
187
- ?>
188
- <table class="widefat">
189
- <thead>
190
- <tr class="thead">
191
- <th><?php _e( 'Username', $this->plugin_id ); ?></th>
192
- <th><?php _e( 'Name', $this->plugin_id ); ?></th>
193
- <th><?php _e( 'E-mail', $this->plugin_id ); ?></th>
194
- <?php if ( 'pending' == $status ) { ?>
195
- <th colspan="2" style="text-align: center"><?php _e( 'Actions', $this->plugin_id ); ?></th>
196
- <?php } else { ?>
197
- <th style="text-align: center"><?php _e( 'Actions', $this->plugin_id ); ?></th>
198
- <?php } ?>
199
- </tr>
200
- </thead>
201
- <tbody>
202
- <?php
203
- // show each of the users
204
- $row = 1;
205
- foreach ( $users as $user ) {
206
- $class = ( $row % 2 ) ? '' : ' class="alternate"';
207
- $avatar = get_avatar( $user->user_email, 32 );
208
- if ( $approve ) {
209
- $approve_link = get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=approve';
210
- $approve_link = wp_nonce_url( $approve_link, 'pw_new_user_approve_action_' . get_class( $this ) );
211
- }
212
- if ( $deny ) {
213
- $deny_link = get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . '&user=' . $user->ID . '&status=deny';
214
- $deny_link = wp_nonce_url( $deny_link, 'pw_new_user_approve_action_' . get_class( $this ) );
215
- }
216
- if ( current_user_can( 'edit_user', $user->ID ) ) {
217
- if ($current_user->ID == $user->ID) {
218
- $edit_link = 'profile.php';
219
- } else {
220
- $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user->ID" ) );
221
- }
222
- $edit = '<strong><a href="' . $edit_link . '">' . $user->user_login . '</a></strong><br />';
223
- } else {
224
- $edit = '<strong>' . $user->user_login . '</strong>';
225
- }
226
-
227
- ?><tr <?php echo $class; ?>>
228
- <td><?php echo $avatar . ' ' . $edit; ?></td>
229
- <td><?php echo get_user_meta( $user->ID, 'first_name', true ) . ' ' . get_user_meta( $user->ID, 'last_name', true ); ?></td>
230
- <td><a href="mailto:<?php echo $user->user_email; ?>" title="<?php _e('email:', $this->plugin_id) ?> <?php echo $user->user_email; ?>"><?php echo $user->user_email; ?></a></td>
231
- <?php if ( $approve ) { ?>
232
- <td align="center"><a href="<?php echo $approve_link; ?>" title="<?php _e( 'Approve', $this->plugin_id ); ?> <?php echo $user->user_login; ?>"><?php _e( 'Approve', $this->plugin_id ); ?></a></td>
233
- <?php } ?>
234
- <?php if ( $deny ) { ?>
235
- <td align="center"><a href="<?php echo $deny_link; ?>" title="<?php _e( 'Deny', $this->plugin_id ); ?> <?php echo $user->user_login; ?>"><?php _e( 'Deny', $this->plugin_id ); ?></a></td>
236
- <?php } ?>
237
- </tr><?php
238
- $row++;
239
- }
240
- ?>
241
- </tbody>
242
- </table>
243
- <?php
244
- } else {
245
- $status_i18n = $status;
246
- if ( $status == 'approved' ) {
247
- $status_i18n = __( 'approved', $this->plugin_id );
248
- } else if ( $status == 'denied' ) {
249
- $status_i18n = __( 'denied', $this->plugin_id );
250
- } else if ( $status == 'pending' ) {
251
- $status_i18n = __( 'pending', $this->plugin_id );
252
- }
253
-
254
- echo '<p>'.sprintf( __( 'There are no users with a status of %s', $this->plugin_id ), $status_i18n ) . '</p>';
255
- }
256
- }
257
-
258
- /**
259
- * Send an email to the admin to request approval
260
- */
261
- public function send_approval_email( $user_login, $user_email, $errors ) {
262
- if ( ! $errors->get_error_code() ) {
263
- /* check if already exists */
264
- $user_data = get_user_by( 'login', $user_login );
265
- if ( ! empty( $user_data ) ){
266
- $errors->add( 'registration_required' , __( 'User name already exists', $this->plugin_id ), 'message' );
267
- } else {
268
- /* send email to admin for approval */
269
- $message = sprintf( __( '%1$s (%2$s) has requested a username at %3$s', $this->plugin_id ), $user_login, $user_email, get_option( 'blogname' ) ) . "\r\n\r\n";
270
- $message .= get_option( 'siteurl' ) . "\r\n\r\n";
271
- $message .= sprintf( __( 'To approve or deny this user access to %s go to', $this->plugin_id ), get_option( 'blogname' ) ) . "\r\n\r\n";
272
- $message .= get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . "\r\n";
273
-
274
- $message = apply_filters( 'new_user_approve_request_approval_message', $message, $user_login, $user_email );
275
-
276
- $subject = sprintf( __( '[%s] User Approval', $this->plugin_id ), get_option( 'blogname' ) );
277
- $subject = apply_filters( 'new_user_approve_request_approval_subject', $subject );
278
-
279
- // send the mail
280
- wp_mail( get_option( 'admin_email' ), $subject, $message );
281
-
282
- // create the user
283
- $user_pass = wp_generate_password();
284
- $user_id = wp_create_user( $user_login, $user_pass, $user_email );
285
- }
286
- }
287
  }
288
-
289
- /**
290
- * Admin approval of user
291
- */
292
- public function approve_user() {
293
- global $wpdb;
294
-
295
- $user_id = (int) $_GET['user'];
296
- $user = new WP_User( $user_id );
297
-
298
- $bypass_password_reset = apply_filters( 'new_user_approve_bypass_password_reset', false );
299
-
300
- if ( ! $bypass_password_reset ) {
301
- // reset password to know what to send the user
302
- $new_pass = wp_generate_password();
303
- $data = array(
304
- 'user_pass' => md5($new_pass),
305
- 'user_activation_key' => '',
306
- );
307
- $where = array(
308
- 'ID' => $user->ID,
309
- );
310
- $wpdb->update($wpdb->users, $data, $where, array( '%s', '%s' ), array( '%d' ) );
311
- }
312
-
313
- wp_cache_delete( $user->ID, 'users' );
314
- wp_cache_delete( $user->user_login, 'userlogins' );
315
-
316
- // send email to user telling of approval
317
- $user_login = stripslashes( $user->user_login );
318
- $user_email = stripslashes( $user->user_email );
319
-
320
- // format the message
321
- $message = sprintf( __( 'You have been approved to access %s', $this->plugin_id ), get_option( 'blogname' ) ) . "\r\n";
322
- $message .= sprintf( __( 'Username: %s', $this->plugin_id ), $user_login ) . "\r\n";
323
- if ( ! $bypass_password_reset ) {
324
- $message .= sprintf( __( 'Password: %s', $this->plugin_id ), $new_pass ) . "\r\n";
325
- }
326
- $message .= get_option( 'siteurl' ) . "/wp-login.php\r\n";
327
-
328
- $message = apply_filters( 'new_user_approve_approve_user_message', $message, $user );
329
-
330
- $subject = sprintf( __( '[%s] Registration Approved', $this->plugin_id ), get_option( 'blogname' ) );
331
- $subject = apply_filters( 'new_user_approve_approve_user_subject', $subject );
332
-
333
- // send the mail
334
- @wp_mail( $user_email, $subject, $message );
335
-
336
- // change usermeta tag in database to approved
337
- update_user_meta( $user->ID, 'pw_user_status', 'approved' );
338
-
339
- do_action( 'new_user_approve_user_approved', $user );
340
- }
341
-
342
- /**
343
- * Admin denial of user
344
- */
345
- public function deny_user() {
346
- $user_id = (int) $_GET['user'];
347
- $user = new WP_User( $user_id );
348
-
349
- // send email to user telling of denial
350
- $user_email = stripslashes( $user->user_email );
351
-
352
- // format the message
353
- $message = sprintf( __( 'You have been denied access to %s', $this->plugin_id ), get_option( 'blogname' ) );
354
- $message = apply_filters( 'new_user_approve_deny_user_message', $message, $user );
355
-
356
- $subject = sprintf( __( '[%s] Registration Denied', $this->plugin_id ), get_option( 'blogname' ) );
357
- $subject = apply_filters( 'new_user_approve_deny_user_subject', $subject );
358
-
359
- // send the mail
360
- @wp_mail( $user_email, $subject, $message );
361
-
362
- // change usermeta tag in database to denied
363
- update_user_meta( $user->ID, 'pw_user_status', 'denied' );
364
-
365
- do_action( 'new_user_approve_user_denied', $user );
366
- }
367
-
368
- /**
369
- * Display a message to the user after they have registered
370
- */
371
- public function show_user_pending_message($errors) {
372
- if ( ! empty( $_POST['redirect_to'] ) ) {
373
- // if a redirect_to is set, honor it
374
- wp_safe_redirect( $_POST['redirect_to'] );
375
- exit();
376
- }
377
-
378
- // if there is an error already, let it do it's thing
379
- if ( $errors->get_error_code() )
380
- return $errors;
381
-
382
- $message = sprintf( __( 'An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request.', $this->plugin_id ) );
383
- $message .= sprintf( __( 'You will receive an email with instructions on what you will need to do next. Thanks for your patience.', $this->plugin_id ) );
384
- $message = apply_filters( 'new_user_approve_pending_message', $message );
385
-
386
- $errors->add( 'registration_required', $message, 'message' );
387
-
388
- $success_message = __( 'Registration successful.', $this->plugin_id );
389
- $success_message = apply_filters( 'new_user_approve_registration_message', $success_message );
390
-
391
- if ( function_exists( 'login_header' ) ) {
392
- login_header( __( 'Pending Approval', $this->plugin_id ), '<p class="message register">' . $success_message . '</p>', $errors );
393
- login_footer();
394
-
395
- // an exit is necessay here so the normal process for user registration doesn't happen
396
- exit();
397
- }
398
- }
399
-
400
- /**
401
- * Accept input from admin to modify a user
402
- */
403
- public function process_input() {
404
- if ( ( isset( $_GET['page'] ) && $_GET['page'] == $this->_admin_page ) && isset( $_GET['status'] ) ) {
405
- $valid_request = check_admin_referer( 'pw_new_user_approve_action_' . get_class( $this ) );
406
-
407
- if ( $valid_request ) {
408
- if ( $_GET['status'] == 'approve' ) {
409
- do_action( 'new_user_approve_approve_user' );
410
- }
411
-
412
- if ( $_GET['status'] == 'deny' ) {
413
- do_action( 'new_user_approve_deny_user' );
414
- }
415
- }
416
- }
417
- }
418
-
419
- /**
420
- * Only give a user their password if they have been approved
421
- */
422
- public function lost_password() {
423
- $is_email = strpos( $_POST['user_login'], '@' );
424
- if ( $is_email === false ) {
425
- $username = sanitize_user( $_POST['user_login'] );
426
- $user_data = get_user_by( 'login', trim( $username ) );
427
- } else {
428
- $email = is_email( $_POST['user_login'] );
429
- $user_data = get_user_by( 'email', $email );
430
- }
431
-
432
- if ( $user_data->pw_user_status && $user_data->pw_user_status != 'approved' ) {
433
- wp_redirect( 'wp-login.php' );
434
- exit();
435
- }
436
-
437
- return;
438
- }
439
-
440
- /**
441
- * Add message to login page saying registration is required.
442
- *
443
- * @param string $message
444
- * @return string
445
- */
446
- public function welcome_user($message) {
447
- if ( ! isset( $_GET['action'] ) ) {
448
- $welcome = sprintf( __( 'Welcome to %s. This site is accessible to approved users only. To be approved, you must first register.', $this->plugin_id ), get_option( 'blogname' ) );
449
- $welcome = apply_filters( 'new_user_approve_welcome_message', $welcome );
450
-
451
- if ( ! empty( $welcome ) ) {
452
- $message .= '<p class="message">' . $welcome . '</p>';
453
- }
454
- }
455
-
456
- if ( isset( $_GET['action'] ) && $_GET['action'] == 'register' && ! $_POST ) {
457
- $instructions = sprintf( __( 'After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions.', $this->plugin_id ) );
458
- $instructions = apply_filters( 'new_user_approve_register_instructions', $instructions );
459
-
460
- if ( ! empty( $instructions ) ) {
461
- $message .= '<p class="message">' . $instructions . '</p>';
462
- }
463
- }
464
-
465
- return $message;
466
- }
467
-
468
  /**
469
- * Determine if the user is good to sign inbased on their status
470
- *
471
- * @param array $userdata
472
- * @param string $password
473
  */
474
- public function authenticate_user( $userdata, $password ) {
475
- $status = get_user_meta( $userdata->ID, 'pw_user_status', true );
476
-
477
- if ( empty( $status ) ) {
478
- // the user does not have a status so let's assume the user is good to go
479
- return $userdata;
480
- }
481
-
482
- $message = false;
483
- switch ( $status ) {
484
- case 'pending':
485
- $pending_message = __( '<strong>ERROR</strong>: Your account is still pending approval.' );
486
- $pending_message = apply_filters( 'new_user_approve_pending_error', $pending_message );
487
-
488
- $message = new WP_Error( 'pending_approval', $pending_message );
489
- break;
490
- case 'denied':
491
- $denied_message = __( '<strong>ERROR</strong>: Your account has been denied access to this site.' );
492
- $denied_message = apply_filters( 'new_user_approve_denied_error', $denied_message );
493
-
494
- $message = new WP_Error( 'denied_access', $denied_message );
495
- break;
496
- case 'approved':
497
- $message = $userdata;
498
- break;
499
- }
500
-
501
- return $message;
502
  }
503
 
504
- /**
505
- * Give the user a status
506
- * @param int $user_id
507
- */
508
- public function add_user_status( $user_id ) {
509
- $status = 'pending';
510
- if ( isset( $_REQUEST['action'] ) && 'createuser' == $_REQUEST['action'] ) {
511
- $status = 'approved';
512
- }
513
- update_user_meta( $user_id, 'pw_user_status', $status );
514
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
 
516
- /**
517
- * Get a status of all the users and save them using a transient
518
- */
519
- public function get_user_statuses() {
520
- $valid_stati = array( 'pending', 'approved', 'denied' );
521
- $user_status = get_transient( 'new_user_approve_user_statuses' );
522
-
523
- if ( false === $user_status ) {
524
- $user_status = array();
525
-
526
- foreach ( $valid_stati as $status ) {
527
- // Query the users table
528
- if ( $status != 'approved' ) {
529
- // Query the users table
530
- $query = array(
531
- 'meta_key' => 'pw_user_status',
532
- 'meta_value' => $status,
533
- );
534
- $wp_user_search = new WP_User_Query( $query );
535
- } else {
536
- $users = get_users( 'blog_id=1' );
537
- $approved_users = array();
538
- foreach( $users as $user ) {
539
- $the_status = get_user_meta( $user->ID, 'pw_user_status', true );
540
-
541
- if ( $the_status == 'approved' || empty( $the_status ) ) {
542
- $approved_users[] = $user->ID;
543
- }
544
- }
545
-
546
- // get all approved users and any user without a status
547
- $query = array( 'include' => $approved_users );
548
- $wp_user_search = new WP_User_Query( $query );
549
- }
550
-
551
- $user_status[$status] = $wp_user_search->get_results();
552
-
553
- set_transient( 'new_user_approve_user_statuses', $user_status );
554
- }
555
- }
556
-
557
- foreach ( $valid_stati as $status ) {
558
- $user_status[$status] = apply_filters( 'new_user_approve_user_status', $user_status[$status], $status );
559
- }
560
-
561
- return $user_status;
562
- }
563
-
564
- public function delete_new_user_approve_transient() {
565
- delete_transient( 'new_user_approve_user_statuses' );
566
- }
567
-
568
  } // End Class
569
- } // End if class exists statement
570
 
571
- // instantiate the class
572
- if ( class_exists( 'pw_new_user_approve' ) ) {
573
- $pw_new_user_approve = new pw_new_user_approve();
574
  }
 
 
2
  /*
3
  Plugin Name: New User Approve
4
  Plugin URI: http://www.picklewagon.com/wordpress/new-user-approve/
5
+ Description: Allow administrators to approve users once they register. Only approved users will be allowed to access the blog. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
6
  Author: Josh Harrison
7
+ Version: 1.5
8
  Author URI: http://www.picklewagon.com/
9
  */
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  class pw_new_user_approve {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ /**
14
+ * The only instance of pw_new_user_approve.
15
+ *
16
+ * @var pw_new_user_approve
17
+ */
18
+ private static $instance;
19
+
20
+ /**
21
+ * Returns the main instance.
22
+ *
23
+ * @return pw_new_user_approve
24
+ */
25
+ public static function instance() {
26
+ if ( ! isset( self::$instance ) ) {
27
+ self::$instance = new pw_new_user_approve();
28
+ }
29
+ return self::$instance;
30
+ }
31
+
32
+ private function __construct() {
33
  // Load up the localization file if we're using WordPress in a different language
34
  // Just drop it in this plugin's "localization" folder and name it "new-user-approve-[value in wp-config].mo"
35
+ load_plugin_textdomain( 'new-user-approve', false, dirname( plugin_basename( __FILE__ ) ) . '/localization' );
36
+
37
+ register_activation_hook( __FILE__, array( $this, 'activation' ) );
38
+ register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
39
+
40
+ // Actions
41
+ add_action( 'plugins_loaded', array( $this, 'include_files' ) );
42
+ add_action( 'wp_loaded', array( $this, 'admin_loaded' ) );
43
+ add_action( 'rightnow_end', array( $this, 'dashboard_stats' ) );
44
+ add_action( 'user_register', array( $this, 'delete_new_user_approve_transient' ), 11 );
45
+ add_action( 'new_user_approve_approve_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
46
+ add_action( 'new_user_approve_deny_user', array( $this, 'delete_new_user_approve_transient' ), 11 );
47
+ add_action( 'deleted_user', array( $this, 'delete_new_user_approve_transient' ) );
48
+ add_action( 'register_post', array( $this, 'request_admin_approval_email' ), 10, 3 );
49
+ add_action( 'register_post', array( $this, 'create_new_user' ), 10, 3 );
50
+ add_action( 'lostpassword_post', array( $this, 'lost_password' ) );
51
+ add_action( 'user_register', array( $this, 'add_user_status' ) );
52
+ add_action( 'new_user_approve_approve_user', array( $this, 'approve_user' ) );
53
+ add_action( 'new_user_approve_deny_user', array( $this, 'deny_user' ) );
54
+
55
+ // Filters
56
+ add_filter( 'wp_authenticate_user', array( $this, 'authenticate_user' ) );
57
+ add_filter( 'registration_errors', array( $this, 'show_user_pending_message' ) );
58
+ add_filter( 'login_message', array( $this, 'welcome_user' ) );
59
+ add_filter( 'new_user_approve_validate_status_update', array( $this, 'validate_status_update' ), 10, 3 );
60
+ }
61
+
62
+ public function get_plugin_url() {
63
+ return plugin_dir_url( __FILE__ );
64
+ }
65
+
66
+ public function get_plugin_dir() {
67
+ return plugin_dir_path( __FILE__ );
68
  }
69
 
70
  /**
71
+ * Require a minimum version of WordPress on activation
72
  *
73
  * @uses register_activation_hook
74
  */
75
+ public function activation() {
76
  global $wp_version;
77
 
78
+ $min_wp_version = '3.5.1';
79
+ $exit_msg = sprintf( __( 'New User Approve requires WordPress %s or newer.', 'new-user-approve' ), $min_wp_version );
80
  if ( version_compare( $wp_version, $min_wp_version, '<=' ) ) {
81
  exit( $exit_msg );
82
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
+ // since the right version of WordPress is being used, run a hook
85
+ do_action( 'new_user_approve_activate' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  }
87
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  /**
89
+ * @uses register_deactivation_hook
 
 
 
90
  */
91
+ public function deactivation() {
92
+ do_action( 'new_user_approve_deactivate' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
94
 
95
+ /**
96
+ * Include any external files as part of the plugin.
97
+ *
98
+ * @uses plugins_loaded
99
+ */
100
+ public function include_files() {
101
+ require_once( dirname( __FILE__ ) . '/includes/admin-approve.php' );
102
+ }
103
+
104
+ /**
105
+ * Makes it possible to disable the user admin integration. Must happen after
106
+ * WordPres is loaded.
107
+ *
108
+ * @uses wp_loaded
109
+ */
110
+ public function admin_loaded() {
111
+ $user_admin_integration = apply_filters( 'new_user_approve_user_admin_integration', true );
112
+
113
+ if ( $user_admin_integration ) {
114
+ require_once( dirname( __FILE__ ) . '/includes/user-list.php' );
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Get the status of a user.
120
+ *
121
+ * @param int $user_id
122
+ * @return string the status of the user
123
+ */
124
+ public function get_user_status( $user_id ) {
125
+ $user_status = get_user_meta( $user_id, 'pw_user_status', true );
126
+
127
+ if ( empty( $user_status ) )
128
+ $user_status = 'approved';
129
+
130
+ return $user_status;
131
+ }
132
+
133
+ /**
134
+ * Update the status of a user. The new status must be either 'approve' or 'deny'.
135
+ *
136
+ * @param int $user
137
+ * @param string $status
138
+ */
139
+ public function update_user_status( $user, $status ) {
140
+ $user_id = absint( $user );
141
+ if ( ! $user_id )
142
+ return;
143
+
144
+ if ( ! in_array( $status, array( 'approve', 'deny' ) ) )
145
+ return;
146
+
147
+ $do_update = apply_filters( 'new_user_approve_validate_status_update', true, $user_id, $status );
148
+
149
+ if ( !$do_update )
150
+ return;
151
+
152
+ // where it all happens
153
+ do_action( 'new_user_approve_' . $status . '_user', $user_id );
154
+ }
155
+
156
+ /**
157
+ * Get the valid statuses. Anything outside of the returned array is an invalid status.
158
+ *
159
+ * @return array
160
+ */
161
+ public function get_valid_statuses() {
162
+ return array( 'pending', 'approved', 'denied' );
163
+ }
164
+
165
+ /**
166
+ * Only validate the update if the status has been updated to prevent unnecessary update
167
+ * and especially emails.
168
+ *
169
+ * @param bool $do_update
170
+ * @param int $user_id
171
+ * @param string $status either 'approve' or 'deny'
172
+ */
173
+ public function validate_status_update( $do_update, $user_id, $status ) {
174
+ $current_status = pw_new_user_approve()->get_user_status( $user_id );
175
+
176
+ if ( $status == 'approve' )
177
+ $new_status = 'approved';
178
+ else
179
+ $new_status = 'denied';
180
+
181
+ if ( $current_status == $new_status )
182
+ $do_update = false;
183
+
184
+ return $do_update;
185
+ }
186
+
187
+ /**
188
+ * Determine if the user is good to sign in based on their status.
189
+ *
190
+ * @uses wp_authenticate_user
191
+ * @param array $userdata
192
+ */
193
+ public function authenticate_user( $userdata ) {
194
+ $status = $this->get_user_status( $userdata->ID );
195
+
196
+ if ( empty( $status ) ) {
197
+ // the user does not have a status so let's assume the user is good to go
198
+ return $userdata;
199
+ }
200
+
201
+ $message = false;
202
+ switch ( $status ) {
203
+ case 'pending':
204
+ $pending_message = __( '<strong>ERROR</strong>: Your account is still pending approval.', 'new-user-approve' );
205
+ $pending_message = apply_filters( 'new_user_approve_pending_error', $pending_message );
206
+
207
+ $message = new WP_Error( 'pending_approval', $pending_message );
208
+ break;
209
+ case 'denied':
210
+ $denied_message = __( '<strong>ERROR</strong>: Your account has been denied access to this site.', 'new-user-approve' );
211
+ $denied_message = apply_filters( 'new_user_approve_denied_error', $denied_message );
212
+
213
+ $message = new WP_Error( 'denied_access', $denied_message );
214
+ break;
215
+ case 'approved':
216
+ $message = $userdata;
217
+ break;
218
+ }
219
+
220
+ return $message;
221
+ }
222
+
223
+ /**
224
+ * Get a status of all the users and save them using a transient
225
+ */
226
+ public function get_user_statuses() {
227
+ $valid_stati = $this->get_valid_statuses();
228
+ $user_status = get_transient( 'new_user_approve_user_statuses' );
229
+
230
+ if ( false === $user_status ) {
231
+ $user_status = array();
232
+
233
+ foreach ( $valid_stati as $status ) {
234
+ // Query the users table
235
+ if ( $status != 'approved' ) {
236
+ // Query the users table
237
+ $query = array(
238
+ 'meta_key' => 'pw_user_status',
239
+ 'meta_value' => $status,
240
+ );
241
+ $wp_user_search = new WP_User_Query( $query );
242
+ } else {
243
+ // get all approved users and any user without a status
244
+ $query = array(
245
+ 'meta_query' => array(
246
+ 'relation' => 'OR',
247
+ array(
248
+ 'key' => 'pw_user_status',
249
+ 'value' => 'approved',
250
+ 'compare' => '='
251
+ ),
252
+ array(
253
+ 'key' => 'pw_user_status',
254
+ 'value' => '',
255
+ 'compare' => 'NOT EXISTS'
256
+ ),
257
+ ),
258
+ );
259
+ $wp_user_search = new WP_User_Query( $query );
260
+ }
261
+
262
+ $user_status[$status] = $wp_user_search->get_results();
263
+ }
264
+
265
+ set_transient( 'new_user_approve_user_statuses', $user_status );
266
+ }
267
+
268
+ foreach ( $valid_stati as $status ) {
269
+ $user_status[$status] = apply_filters( 'new_user_approve_user_status', $user_status[$status], $status );
270
+ }
271
+
272
+ return $user_status;
273
+ }
274
+
275
+ /**
276
+ * Delete the transient storing all of the user statuses.
277
+ *
278
+ * @uses user_register
279
+ * @uses deleted_user
280
+ * @uses new_user_approve_approve_user
281
+ * @uses new_user_approve_deny_user
282
+ */
283
+ public function delete_new_user_approve_transient() {
284
+ delete_transient( 'new_user_approve_user_statuses' );
285
+ }
286
+
287
+ /**
288
+ * Display the stats on the WP dashboard. Will show 1 line with a count
289
+ * of users and their status.
290
+ *
291
+ * @uses rightnow_end
292
+ */
293
+ public function dashboard_stats() {
294
+ $user_status = $this->get_user_statuses();
295
+ ?>
296
+ <div>
297
+ <p><span style="font-weight:bold;"><a href="<?php echo apply_filters( 'new_user_approve_dashboard_link', 'users.php' ); ?>"><?php _e( 'Users', 'new-user-approve' ); ?></a></span>:
298
+ <?php foreach ( $user_status as $status => $users ) :
299
+ print count( $users ) . " " . __( $status, 'new-user-approve' ) . "&nbsp;&nbsp;&nbsp;";
300
+ endforeach; ?>
301
+ </p>
302
+ </div>
303
+ <?php
304
+ }
305
+
306
+ /**
307
+ * Send an email to the admin to request approval. If there are already errors,
308
+ * just go back and let core do it's thing.
309
+ *
310
+ * @uses register_post
311
+ * @param string $user_login
312
+ * @param string $user_email
313
+ * @param object $errors
314
+ */
315
+ public function request_admin_approval_email( $user_login, $user_email, $errors ) {
316
+ if ( $errors->get_error_code() ) {
317
+ return $errors;
318
+ }
319
+
320
+ // The blogname option is escaped with esc_html on the way into the database in sanitize_option
321
+ // we want to reverse this for the plain text arena of emails.
322
+ $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
323
+
324
+ /* send email to admin for approval */
325
+ $message = sprintf( __( '%1$s (%2$s) has requested a username at %3$s', 'new-user-approve' ), $user_login, $user_email, $blogname ) . "\r\n\r\n";
326
+ $message .= get_option( 'siteurl' ) . "\r\n\r\n";
327
+ $message .= sprintf( __( 'To approve or deny this user access to %s go to', 'new-user-approve' ), $blogname ) . "\r\n\r\n";
328
+ $message .= get_option( 'siteurl' ) . '/wp-admin/users.php?page=' . $this->_admin_page . "\r\n";
329
+
330
+ $message = apply_filters( 'new_user_approve_request_approval_message', $message, $user_login, $user_email );
331
+
332
+ $subject = sprintf( __( '[%s] User Approval', 'new-user-approve' ), $blogname );
333
+ $subject = apply_filters( 'new_user_approve_request_approval_subject', $subject );
334
+
335
+ // send the mail
336
+ wp_mail( get_option( 'admin_email' ), $subject, $message, $this->email_message_headers() );
337
+ }
338
+
339
+ /**
340
+ * Create a new user after the registration has been validated. Normally,
341
+ * when a user registers, an email is sent to the user containing their
342
+ * username and password. The email does not get sent to the user until
343
+ * the user is approved when using the default behavior of this plugin.
344
+ *
345
+ * @uses register_post
346
+ * @param string $user_login
347
+ * @param string $user_email
348
+ * @param object $errors
349
+ */
350
+ public function create_new_user( $user_login, $user_email, $errors ) {
351
+ if ( $errors->get_error_code() ) {
352
+ return $errors;
353
+ }
354
+
355
+ // create the user
356
+ $user_pass = wp_generate_password( 12, false );
357
+ $user_id = wp_create_user( $user_login, $user_pass, $user_email );
358
+ if ( ! $user_id ) {
359
+ $errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
360
+ return $errors;
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Admin approval of user
366
+ *
367
+ * @uses new_user_approve_approve_user
368
+ */
369
+ public function approve_user( $user_id ) {
370
+ $user = new WP_User( $user_id );
371
+
372
+ // password should only be reset for users that:
373
+ // * have never logged in
374
+ // * are just approved for the first time
375
+
376
+ // If the password has already been reset for this user,
377
+ // $password_reset will be a unix timestamp
378
+ $password_reset = get_user_meta( $user_id, 'pw_user_approve_password_reset' );
379
+
380
+ // Get the current user status. By default each user is given a pending
381
+ // status when the user is created (with this plugin activated). If the
382
+ // user was created while this plugin was not active, the user will not
383
+ // have a status set.
384
+ $user_status = get_user_meta( $user_id, 'pw_user_status' );
385
+
386
+ // Default behavior is to reset password
387
+ $bypass_password_reset = false;
388
+
389
+ // if no status is set, don't reset password
390
+ if ( empty( $user_status ) )
391
+ $bypass_password_reset = true;
392
+
393
+ // if the password has already been reset, absolutely bypass
394
+ if ( empty( $password_reset ) )
395
+ $bypass_password_reset = true;
396
+
397
+ $bypass_password_reset = apply_filters( 'new_user_approve_bypass_password_reset', $bypass_password_reset );
398
+
399
+ if ( ! $bypass_password_reset ) {
400
+ global $wpdb;
401
+
402
+ // reset password to know what to send the user
403
+ $new_pass = wp_generate_password( 12, false );
404
+ $data = array(
405
+ 'user_pass' => md5( $new_pass ),
406
+ 'user_activation_key' => '',
407
+ );
408
+ $where = array(
409
+ 'ID' => $user->ID,
410
+ );
411
+ $wpdb->update( $wpdb->users, $data, $where, array( '%s', '%s' ), array( '%d' ) );
412
+
413
+ // Set up the Password change nag.
414
+ update_user_option( $user->ID, 'default_password_nag', true, true );
415
+
416
+ // Set this meta field to track that the password has been reset by
417
+ // the plugin. Don't reset it again.
418
+ update_user_meta( $user->ID, 'pw_user_approve_password_reset', time() );
419
+ }
420
+
421
+ wp_cache_delete( $user->ID, 'users' );
422
+ wp_cache_delete( $user->user_login, 'userlogins' );
423
+
424
+ // send email to user telling of approval
425
+ $user_login = stripslashes( $user->user_login );
426
+ $user_email = stripslashes( $user->user_email );
427
+
428
+ // format the message
429
+ $message = sprintf( __( 'You have been approved to access %s', 'new-user-approve' ), get_option( 'blogname' ) ) . "\r\n";
430
+ $message .= sprintf( __( 'Username: %s', 'new-user-approve' ), $user_login ) . "\r\n";
431
+ if ( ! $bypass_password_reset ) {
432
+ $message .= sprintf( __( 'Password: %s', 'new-user-approve' ), $new_pass ) . "\r\n";
433
+ }
434
+ $message .= wp_login_url() . "\r\n";
435
+
436
+ $message = apply_filters( 'new_user_approve_approve_user_message', $message, $user );
437
+
438
+ $subject = sprintf( __( '[%s] Registration Approved', 'new-user-approve' ), get_option( 'blogname' ) );
439
+ $subject = apply_filters( 'new_user_approve_approve_user_subject', $subject );
440
+
441
+ // send the mail
442
+ wp_mail( $user_email, $subject, $message, $this->email_message_headers() );
443
+
444
+ // change usermeta tag in database to approved
445
+ update_user_meta( $user->ID, 'pw_user_status', 'approved' );
446
+
447
+ do_action( 'new_user_approve_user_approved', $user );
448
+ }
449
+
450
+ /**
451
+ * Admin denial of user
452
+ *
453
+ * @uses new_user_approve_deny_user
454
+ */
455
+ public function deny_user( $user_id ) {
456
+ $user = new WP_User( $user_id );
457
+
458
+ // send email to user telling of denial
459
+ $user_email = stripslashes( $user->user_email );
460
+
461
+ // format the message
462
+ $message = sprintf( __( 'You have been denied access to %s', 'new-user-approve' ), get_option( 'blogname' ) );
463
+ $message = apply_filters( 'new_user_approve_deny_user_message', $message, $user );
464
+
465
+ $subject = sprintf( __( '[%s] Registration Denied', 'new-user-approve' ), get_option( 'blogname' ) );
466
+ $subject = apply_filters( 'new_user_approve_deny_user_subject', $subject );
467
+
468
+ // send the mail
469
+ @wp_mail( $user_email, $subject, $message, $this->email_message_headers() );
470
+
471
+ // change usermeta tag in database to denied
472
+ update_user_meta( $user->ID, 'pw_user_status', 'denied' );
473
+
474
+ do_action( 'new_user_approve_user_denied', $user );
475
+ }
476
+
477
+ public function email_message_headers() {
478
+ $admin_email = get_option( 'admin_email' );
479
+ if ( empty( $admin_email ) )
480
+ $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
481
+
482
+ $from_name = get_option( 'blogname' );
483
+
484
+ $headers = array(
485
+ "MIME-Version: 1.0\n",
486
+ "From: \"{$from_name}\" <{$admin_email}>\n",
487
+ "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n",
488
+ );
489
+
490
+ $headers = apply_filters( 'new_user_approve_email_header', $headers );
491
+
492
+ return $headers;
493
+ }
494
+
495
+ /**
496
+ * Display a message to the user after they have registered
497
+ *
498
+ * @uses registration_errors
499
+ */
500
+ public function show_user_pending_message($errors) {
501
+ if ( ! empty( $_POST['redirect_to'] ) ) {
502
+ // if a redirect_to is set, honor it
503
+ wp_safe_redirect( $_POST['redirect_to'] );
504
+ exit();
505
+ }
506
+
507
+ // if there is an error already, let it do it's thing
508
+ if ( $errors->get_error_code() )
509
+ return $errors;
510
+
511
+ $message = sprintf( __( 'An email has been sent to the site administrator. The administrator will review the information that has been submitted and either approve or deny your request.', 'new-user-approve' ) );
512
+ $message .= ' ';
513
+ $message .= sprintf( __( 'You will receive an email with instructions on what you will need to do next. Thanks for your patience.', 'new-user-approve' ) );
514
+ $message = apply_filters( 'new_user_approve_pending_message', $message );
515
+
516
+ $errors->add( 'registration_required', $message, 'message' );
517
+
518
+ $success_message = __( 'Registration successful.', 'new-user-approve' );
519
+ $success_message = apply_filters( 'new_user_approve_registration_message', $success_message );
520
+
521
+ login_header( __( 'Pending Approval', 'new-user-approve' ), '<p class="message register">' . $success_message . '</p>', $errors );
522
+ login_footer();
523
+
524
+ // an exit is necessary here so the normal process for user registration doesn't happen
525
+ exit();
526
+ }
527
+
528
+ /**
529
+ * Only give a user their password if they have been approved
530
+ *
531
+ * @uses lostpassword_post
532
+ */
533
+ public function lost_password() {
534
+ $is_email = strpos( $_POST['user_login'], '@' );
535
+ if ( $is_email === false ) {
536
+ $username = sanitize_user( $_POST['user_login'] );
537
+ $user_data = get_user_by( 'login', trim( $username ) );
538
+ } else {
539
+ $email = is_email( $_POST['user_login'] );
540
+ $user_data = get_user_by( 'email', $email );
541
+ }
542
+
543
+ if ( $user_data->pw_user_status && $user_data->pw_user_status != 'approved' ) {
544
+ wp_redirect( 'wp-login.php' );
545
+ exit();
546
+ }
547
+ }
548
+
549
+ /**
550
+ * Add message to login page saying registration is required.
551
+ *
552
+ * @uses login_message
553
+ * @param string $message
554
+ * @return string
555
+ */
556
+ public function welcome_user($message) {
557
+ if ( ! isset( $_GET['action'] ) ) {
558
+ $welcome = sprintf( __( 'Welcome to %s. This site is accessible to approved users only. To be approved, you must first register.', 'new-user-approve' ), get_option( 'blogname' ) );
559
+ $welcome = apply_filters( 'new_user_approve_welcome_message', $welcome );
560
+
561
+ if ( ! empty( $welcome ) ) {
562
+ $message .= '<p class="message register">' . $welcome . '</p>';
563
+ }
564
+ }
565
+
566
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'register' && ! $_POST ) {
567
+ $instructions = sprintf( __( 'After you register, your request will be sent to the site administrator for approval. You will then receive an email with further instructions.', 'new-user-approve' ) );
568
+ $instructions = apply_filters( 'new_user_approve_register_instructions', $instructions );
569
+
570
+ if ( ! empty( $instructions ) ) {
571
+ $message .= '<p class="message register">' . $instructions . '</p>';
572
+ }
573
+ }
574
+
575
+ return $message;
576
+ }
577
+
578
+ /**
579
+ * Give the user a status
580
+ *
581
+ * @uses user_register
582
+ * @param int $user_id
583
+ */
584
+ public function add_user_status( $user_id ) {
585
+ $status = 'pending';
586
+
587
+ // This check needs to happen when a user is created in the admin
588
+ if ( isset( $_REQUEST['action'] ) && 'createuser' == $_REQUEST['action'] ) {
589
+ $status = 'approved';
590
+ }
591
+ update_user_meta( $user_id, 'pw_user_status', $status );
592
+ }
593
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  } // End Class
 
595
 
596
+ function pw_new_user_approve() {
597
+ return pw_new_user_approve::instance();
 
598
  }
599
+
600
+ pw_new_user_approve();
readme.txt CHANGED
@@ -1,17 +1,19 @@
1
  === Plugin Name ===
2
  Contributors: picklewagon
3
  Donate link: http://picklewagon.com/wordpress/new-user-approve/donate
4
- Tags: users, registration
5
- Requires at least: 3.2.1
6
- Tested up to: 3.5
7
- Stable tag: 1.4.2
8
-
9
- New User Approve is a Wordpress plugin that allows a blog administrator to
 
 
10
  approve a user before they are able to access and login to the blog.
11
 
12
  == Description ==
13
 
14
- In a normal Wordpress blog, once a new user registers, the user is created in
15
  the database. Then an email is sent to the new user with their login
16
  credentials. Very simple. As it should be.
17
 
@@ -19,7 +21,7 @@ The New User Approve plugin modifies the registration process. When a user
19
  registers for the blog, the user gets created and then an email gets sent to
20
  the administrators of the site. An administrator then is expected to either
21
  approve or deny the registration request. An email is then sent to the user
22
- indicating whether they were approved or denied. If the user was approved,
23
  the email will include the login credentials. Until a user is approved, the
24
  user will not be able to login to the site.
25
 
@@ -50,7 +52,7 @@ your liking.
50
 
51
  The password is generated again because, by default, the user will not be aware
52
  of their password. By generating a new password, the email that notifies the
53
- user can also give them the new password just like the email does when recieving
54
  your password on a regular WordPress install. At approval time, it is impossible
55
  to retrieve the user's password.
56
 
@@ -59,10 +61,25 @@ this feature.
59
 
60
  == Screenshots ==
61
 
62
- 1. The backend to manage approving and denying users.
 
 
 
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  = 1.4.2 =
67
  * fix password recovery bug if a user does not have an approve-status meta field
68
  * add more translations
@@ -160,6 +177,9 @@ this feature.
160
 
161
  == Upgrade Notice ==
162
 
 
 
 
163
  = 1.3 =
164
  This version fixes some issues when authenticating users. Requires at least WordPress 3.1.
165
 
@@ -171,6 +191,8 @@ Download version 1.3.2 immediately! A bug was found in version 1.3 that allows a
171
 
172
  == Other Notes ==
173
 
 
 
174
  = Filters =
175
  * *new_user_approve_user_status* - modify the list of users shown in the tables
176
  * *new_user_approve_request_approval_message* - modify the request approval message
@@ -192,13 +214,14 @@ Download version 1.3.2 immediately! A bug was found in version 1.3 that allows a
192
  * *new_user_approve_deny_user* - when the user has been denied
193
 
194
  = Translations =
195
- The plugin has been prepared to be translated. If you want to help to translate the plugin to your language, please have a look at the localization/new-user-approve.pot file which contains all defintions and may be used with a gettext editor like Poedit (Windows). More information can be found on the [Codex](http://codex.wordpress.org/Translating_WordPress).
196
 
197
  When sending me your translation files, please send me your wordpress.org username as well.
198
 
199
- * Belarusian translation by [Fat Cow](http://www.fatcow.com/)
 
200
  * Catalan translation by [xoanet](http://profiles.wordpress.org/xoanet/)
201
- * Croation translation by Nik
202
  * Czech translation by [GazikT](http://profiles.wordpress.org/gazikt/)
203
  * Danish translation by [GeorgWP](http://wordpress.org/support/profile/georgwp)
204
  * Dutch translation by [Ronald Moolenaar](http://profiles.wordpress.org/moolie/)
@@ -206,11 +229,13 @@ When sending me your translation files, please send me your wordpress.org userna
206
  * French translation by [Philippe Scoffoni](http://philippe.scoffoni.net/)
207
  * German translation by Christoph Ploedt
208
  * Greek translation by [Leftys](http://alt3rnet.info/)
 
209
  * Hungarian translation by Gabor Varga
210
  * Italian translation by [Pierfrancesco Marsiaj](http://profiles.wordpress.org/pierinux/)
211
  * Lithuanian translation by [Ksaveras](http://profiles.wordpress.org/xawiers)
212
  * Polish translation by [pik256](http://wordpress.org/support/profile/1271256)
213
  * Romanian translation by [Web Hosting Geeks](http://webhostinggeeks.com/)
214
- * Russion translation by [Alexey](http://wordpress.org/support/profile/asel)
 
215
  * Spanish translation by [Eduardo Aranda](http://sinetiks.com/)
216
- * Swedish translation by [Per Bjlevik](http://pastis.tauzero.se)
1
  === Plugin Name ===
2
  Contributors: picklewagon
3
  Donate link: http://picklewagon.com/wordpress/new-user-approve/donate
4
+ Tags: users, registration, sign up, user management
5
+ Requires at least: 3.5.1
6
+ Tested up to: 3.6
7
+ Stable tag: 1.5
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ New User Approve is a WordPress plugin that allows a blog administrator to
12
  approve a user before they are able to access and login to the blog.
13
 
14
  == Description ==
15
 
16
+ On a normal WordPress site, once a new user registers, the user is created in
17
  the database. Then an email is sent to the new user with their login
18
  credentials. Very simple. As it should be.
19
 
21
  registers for the blog, the user gets created and then an email gets sent to
22
  the administrators of the site. An administrator then is expected to either
23
  approve or deny the registration request. An email is then sent to the user
24
+ indicating whether they were approved or denied. If the user has been approved,
25
  the email will include the login credentials. Until a user is approved, the
26
  user will not be able to login to the site.
27
 
52
 
53
  The password is generated again because, by default, the user will not be aware
54
  of their password. By generating a new password, the email that notifies the
55
+ user can also give them the new password just like the email does when receiving
56
  your password on a regular WordPress install. At approval time, it is impossible
57
  to retrieve the user's password.
58
 
61
 
62
  == Screenshots ==
63
 
64
+ 1. The backend to manage approving and denying users. This is an alternative to approving users.
65
+ 2. Integration with WordPress Users admin page.
66
+ 3. Filter users by status.
67
+ 4. Approve or deny users using the bulk edit feature in WordPress.
68
 
69
  == Changelog ==
70
 
71
+ = 1.5 =
72
+ * add more logic to prevent unwanted password resets
73
+ * add more translations
74
+ * minor bug fixes
75
+ * use core definition of tabs
76
+ * user query updates (requires 3.5)
77
+ * add status attribute to user profile page
78
+ * integration with core user table (bulk approve, filtering, etc.)
79
+ * tested with WordPress 3.6
80
+ * set email header when sending email
81
+ * more filters and actions
82
+
83
  = 1.4.2 =
84
  * fix password recovery bug if a user does not have an approve-status meta field
85
  * add more translations
177
 
178
  == Upgrade Notice ==
179
 
180
+ = 1.5 =
181
+ A long awaited upgrade that includes better integration with WordPress core. Requires at least WordPress 3.5.
182
+
183
  = 1.3 =
184
  This version fixes some issues when authenticating users. Requires at least WordPress 3.1.
185
 
191
 
192
  == Other Notes ==
193
 
194
+ The code for this plugin is also available at Github - https://github.com/picklewagon/new-user-approve. Pull requests welcomed.
195
+
196
  = Filters =
197
  * *new_user_approve_user_status* - modify the list of users shown in the tables
198
  * *new_user_approve_request_approval_message* - modify the request approval message
214
  * *new_user_approve_deny_user* - when the user has been denied
215
 
216
  = Translations =
217
+ The plugin has been prepared to be translated. If you want to help to translate the plugin to your language, please have a look at the localization/new-user-approve.pot file which contains all definitions and may be used with a gettext editor like Poedit (Windows). More information can be found on the [Codex](http://codex.wordpress.org/Translating_WordPress).
218
 
219
  When sending me your translation files, please send me your wordpress.org username as well.
220
 
221
+ * Belarussian translation by [Fat Cow](http://www.fatcow.com/)
222
+ * Brazilian Portuguese translation by [leogermani](http://profiles.wordpress.org/leogermani/)
223
  * Catalan translation by [xoanet](http://profiles.wordpress.org/xoanet/)
224
+ * Croatian translation by Nik
225
  * Czech translation by [GazikT](http://profiles.wordpress.org/gazikt/)
226
  * Danish translation by [GeorgWP](http://wordpress.org/support/profile/georgwp)
227
  * Dutch translation by [Ronald Moolenaar](http://profiles.wordpress.org/moolie/)
229
  * French translation by [Philippe Scoffoni](http://philippe.scoffoni.net/)
230
  * German translation by Christoph Ploedt
231
  * Greek translation by [Leftys](http://alt3rnet.info/)
232
+ * Hebrew translation by [Udi Burg](http://blog.udiburg.com)
233
  * Hungarian translation by Gabor Varga
234
  * Italian translation by [Pierfrancesco Marsiaj](http://profiles.wordpress.org/pierinux/)
235
  * Lithuanian translation by [Ksaveras](http://profiles.wordpress.org/xawiers)
236
  * Polish translation by [pik256](http://wordpress.org/support/profile/1271256)
237
  * Romanian translation by [Web Hosting Geeks](http://webhostinggeeks.com/)
238
+ * Russian translation by [Alexey](http://wordpress.org/support/profile/asel)
239
+ * Slovakian translation by Boris Gereg
240
  * Spanish translation by [Eduardo Aranda](http://sinetiks.com/)
241
+ * Swedish translation by [Per Bj&auml;levik](http://pastis.tauzero.se)
screenshot-1.png DELETED
Binary file
ui.tabs.css DELETED
@@ -1,129 +0,0 @@
1
- .ui-wrapper { border: 1px solid #50A029; }
2
- .ui-wrapper input, .ui-wrapper textarea { border: 0; }
3
-
4
- /* Caution! Ensure accessibility in print and other media types... */
5
- @media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */
6
- .ui-tabs-hide {
7
- display: none;
8
- }
9
- }
10
-
11
- /* Hide useless elements in print layouts... */
12
- @media print {
13
- .ui-tabs-nav {
14
- display: none;
15
- }
16
- }
17
-
18
- /* Skin */
19
- .ui-tabs-nav, .ui-tabs-panel {
20
- }
21
- .ui-tabs-nav {
22
- list-style: none;
23
- margin: 0;
24
- padding: 0 0 0 3px;
25
- }
26
- .ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */
27
- display: block;
28
- clear: both;
29
- content: " ";
30
- }
31
- .ui-tabs-nav li {
32
- float: left;
33
- margin: 0 0 0 2px;
34
- }
35
- .ui-tabs-nav a, .ui-tabs-nav a span {
36
- float: left; /* fixes dir=ltr problem and other quirks IE */
37
- padding: 0 6px 0 12px;
38
- color: #2583AD;
39
- }
40
- .ui-tabs-nav a {
41
- margin: 6px 0 0; /* position: relative makes opacity fail for disabled tab in IE */
42
- padding-left: 0;
43
- background-position: 100% 0;
44
- text-decoration: none;
45
- white-space: nowrap; /* @ IE 6 */
46
- outline: 0; /* @ Firefox, prevent dotted border after click */
47
- /*background-color:#EAF3FA;*/
48
- background-color:#F1F1F1;
49
- /* border */
50
- border-color: #DFDFDF #DFDFDF #FFFFFF;
51
- border-style:solid;
52
- border-width:1px;
53
- -moz-border-radius-topleft: 3px;
54
- -khtml-border-top-left-radius: 3px;
55
- -webkit-border-top-left-radius: 3px;
56
- border-top-left-radius: 3px;
57
- -moz-border-radius-topright: 3px;
58
- -khtml-border-top-right-radius: 3px;
59
- -webkit-border-top-right-radius: 3px;
60
- border-top-right-radius: 3px;
61
- }
62
- .ui-tabs-nav a:link, .ui-tabs-nav a:visited {
63
- color: #a2a2a2;
64
- }
65
- .ui-tabs-nav .ui-tabs-selected a {
66
- position: relative;
67
- top: 1px;
68
- z-index: 2;
69
- margin-top: 0;
70
- background-position: 100% -23px;
71
- color: #424242;
72
- background-color: #FFF;
73
- }
74
- .ui-tabs-nav a span {
75
- padding-top: 1px;
76
- height: 20px;
77
- background-position: 0 0;
78
- line-height: 20px;
79
- }
80
- .ui-tabs-nav .ui-tabs-selected a span {
81
- padding-top: 0;
82
- height: 27px;
83
- background-position: 0 -23px;
84
- line-height: 27px;
85
- color:#333;
86
- background-color: #FFF;
87
- font-weight:bold;
88
- }
89
- .ui-tabs-nav .ui-tabs-selected a:link, .ui-tabs-nav .ui-tabs-selected a:visited,
90
- .ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */
91
- cursor: text;
92
- }
93
- .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active, .ui-tabs-nav a:hover span,
94
- .ui-tabs-nav .ui-tabs-unselect a:hover, .ui-tabs-nav .ui-tabs-unselect a:focus, .ui-tabs-nav .ui-tabs-unselect a:active { /* @ Opera, we need to be explicit again here now... */
95
- cursor:pointer;
96
- color:#333333;
97
- }
98
- .ui-tabs-disabled {
99
- opacity: .4;
100
- filter: alpha(opacity=40);
101
- }
102
- .ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited {
103
- color: #000;
104
- }
105
- .ui-tabs-panel {
106
- border: 1px solid #dfdfdf !important;
107
- padding: 10px;
108
- background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */
109
- }
110
- /*.ui-tabs-loading em {
111
- * padding: 0 0 0 20px;
112
- * background: url(loading.gif) no-repeat 0 50%;
113
- * }*/
114
-
115
- /* Additional IE specific bug fixes... */
116
- * html .ui-tabs-nav { /* auto clear @ IE 6 & IE 7 Quirks Mode */
117
- display: inline-block;
118
- }
119
- *:first-child+html .ui-tabs-nav { /* auto clear @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
120
- display: inline-block;
121
- }
122
- #pw_email_users {
123
- height:100%;
124
- margin:0;
125
- }
126
- #pw_email_options {
127
- height:100%;
128
- margin:0;
129
- }