Changeset 1525710
- Timestamp:
- 11/01/2016 03:24:05 AM (9 years ago)
- Location:
- new-user-approve/trunk
- Files:
-
- 1 added
- 2 deleted
- 4 edited
-
includes/email-tags.php (modified) (2 diffs)
-
includes/messages.php (modified) (1 diff)
-
includes/user-list.php (modified) (5 diffs)
-
localization/new-user-approve-de_DE.mo (deleted)
-
localization/new-user-approve-de_DE.po (deleted)
-
localization/new-user-approve-ru_RU.mo (added)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
new-user-approve/trunk/includes/email-tags.php
r997107 r1525710 267 267 'context' => array( 'email' ), 268 268 ), 269 array( 270 'tag' => 'reset_password_url', 271 'description' => __( 'The URL for a user to set/reset their password', 'new-user-approve' ), 272 'function' => 'nua_email_tag_reset_password_url', 273 'context' => array( 'email' ), 274 ), 269 275 array( 270 276 'tag' => 'password', … … 393 399 } 394 400 } 401 402 /** 403 * Email template tag: reset_password_url 404 * Generates a link to set or reset the user's password 405 * 406 * @param array $attributes 407 * 408 * @return string reset password URL 409 */ 410 function nua_email_tag_reset_password_url( $attributes ) { 411 global $wpdb; 412 413 $username = $attributes['user_login']; 414 415 // Generate something random for a password reset key. 416 $key = wp_generate_password( 20, false ); 417 418 /** This action is documented in wp-login.php */ 419 do_action( 'retrieve_password_key', $username, $key ); 420 421 // Now insert the key, hashed, into the DB. 422 if ( empty( $wp_hasher ) ) { 423 require_once ABSPATH . WPINC . '/class-phpass.php'; 424 $wp_hasher = new PasswordHash( 8, true ); 425 } 426 $hashed = time() . ':' . $wp_hasher->HashPassword( $key ); 427 $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $username ) ); 428 429 $url = network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($username), 'login'); 430 431 return $url; 432 } -
new-user-approve/trunk/includes/messages.php
r997107 r1525710 8 8 function nua_default_approve_user_message() { 9 9 $message = __( 'You have been approved to access {sitename}', 'new-user-approve' ) . "\r\n\r\n"; 10 $message .= "{username}\r\n"; 11 $message .= "{password}\r\n\r\n"; 12 $message .= "{login_url}"; 10 $message .= "{username}\r\n\r\n"; 11 $message .= "{login_url}\r\n\r\n"; 12 $message .= __( 'To set or reset your password, visit the following address:', 'new-user-approve' ) . "\r\n\r\n"; 13 $message .= "{reset_password_url}"; 13 14 14 15 $message = apply_filters( 'new_user_approve_approve_user_message_default', $message ); -
new-user-approve/trunk/includes/user-list.php
r1057335 r1525710 25 25 // Actions 26 26 add_action( 'load-users.php', array( $this, 'update_action' ) ); 27 add_action( 'restrict_manage_users', array( $this, 'status_filter' ) );27 add_action( 'restrict_manage_users', array( $this, 'status_filter' ), 10, 1 ); 28 28 add_action( 'pre_user_query', array( $this, 'filter_by_status' ) ); 29 29 add_action( 'admin_footer-users.php', array( $this, 'admin_footer' ) ); … … 162 162 * @uses restrict_manage_users 163 163 */ 164 public function status_filter() { 164 public function status_filter( $which ) { 165 $id = 'new_user_approve_filter-' . $which; 166 165 167 $filter_button = submit_button( __( 'Filter', 'new-user-approve' ), 'button', 'pw-status-query-submit', false, array( 'id' => 'pw-status-query-submit' ) ); 166 $filtered_status = ( isset( $_GET['new_user_approve_filter'] ) ) ? esc_attr( $_GET['new_user_approve_filter'] ) : '';168 $filtered_status = $this->selected_status(); 167 169 168 170 ?> 169 <label class="screen-reader-text" 170 for="new_user_approve_filter"><?php _e( 'View all users', 'new-user-approve' ); ?></label> 171 <select id="new_user_approve_filter" name="new_user_approve_filter" style="float: none; margin: 0 0 0 15px;"> 171 <label class="screen-reader-text" for="<?php echo $id ?>"><?php _e( 'View all users', 'new-user-approve' ); ?></label> 172 <select id="<?php echo $id ?>" name="<?php echo $id ?>" style="float: none; margin: 0 0 0 15px;"> 172 173 <option value=""><?php _e( 'View all users', 'new-user-approve' ); ?></option> 173 <?php foreach ( pw_new_user_approve()->get_valid_statuses() as $status ) : ?> 174 <option 175 value="<?php echo esc_attr( $status ); ?>"<?php selected( $status, $filtered_status ); ?>><?php echo esc_html( $status ); ?></option> 176 <?php endforeach; ?> 174 <?php foreach ( pw_new_user_approve()->get_user_statuses() as $status => $users ) : ?> 175 <?php if ( count( $users ) ) : ?> 176 <option value="<?php echo esc_attr( $status ); ?>"<?php selected( $status, $filtered_status ); ?>><?php echo esc_html( $status ); ?></option> 177 <?php endif; ?> 178 <?php endforeach; ?> 177 179 </select> 178 180 <?php echo apply_filters( 'new_user_approve_filter_button', $filter_button ); ?> … … 204 206 } 205 207 206 if ( isset( $_GET['new_user_approve_filter'] ) && $_GET['new_user_approve_filter'] != '') {207 $filter = esc_attr( $_GET['new_user_approve_filter']);208 209 $query->query_from .= " INNER JOIN {$wpdb->usermeta} wp_usermetaON ( {$wpdb->users}.ID = wp_usermeta.user_id )";208 if ( $this->selected_status() != null ) { 209 $filter = $this->selected_status(); 210 211 $query->query_from .= " INNER JOIN {$wpdb->usermeta} ON ( {$wpdb->users}.ID = wp_usermeta.user_id )"; 210 212 211 213 if ( 'approved' == $filter ) { … … 219 221 } 220 222 223 private function selected_status() { 224 if ( ! empty( $_REQUEST['new_user_approve_filter-top'] ) || ! empty( $_REQUEST['new_user_approve_filter-bottom'] ) ) { 225 return esc_attr( ( ! empty( $_REQUEST['new_user_approve_filter-top'] ) ) ? $_REQUEST['new_user_approve_filter-top'] : $_REQUEST['new_user_approve_filter-bottom'] ); 226 } 227 228 return null; 229 } 230 221 231 /** 222 232 * Use javascript to add the ability to bulk modify the status of users. … … 271 281 } 272 282 273 $sendback = remove_query_arg( array( 'approved', 'denied', 'deleted', 'ids', 'new_user_approve_filter', ' pw-status-query-submit', 'new_role' ), wp_get_referer() );283 $sendback = remove_query_arg( array( 'approved', 'denied', 'deleted', 'ids', 'new_user_approve_filter', 'new_user_approve_filter2', 'pw-status-query-submit', 'new_role' ), wp_get_referer() ); 274 284 if ( !$sendback ) { 275 285 $sendback = admin_url( 'users.php' ); -
new-user-approve/trunk/readme.txt
r1252433 r1525710 1 === Plugin Name ===1 === New User Approve === 2 2 Contributors: picklewagon 3 3 Donate link: http://picklewagon.com/wordpress/new-user-approve/donate 4 4 Tags: users, registration, sign up, user management, login 5 5 Requires at least: 3.5.1 6 Tested up to: 4. 3.17 Stable tag: 1.7. 36 Tested up to: 4.6.1 7 Stable tag: 1.7.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 15 16 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 17 the database. Then an email is sent to the new user with their login 18 18 credentials. Very simple. As it should be. 19 19 20 The New User Approve plugin modifies the registration process. When a user 20 The New User Approve plugin modifies the registration process. When a user 21 21 registers for the site, 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 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 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 25 the email will include the login credentials. Until a user is approved, the 26 26 user will not be able to login to the site. 27 27 … … 51 51 6. User logs in to site using login credentials. 52 52 53 [Fork New User Approve on Github](https://github.com/picklewagon/new-user-approve) 54 55 [newuserapprove.com](http://newuserapprove.com/) 53 **[Follow New User Approve on Github](https://github.com/picklewagon/new-user-approve)** 54 55 Further support at [newuserapprove.com](http://newuserapprove.com/). 56 57 **Customize** 58 59 New User Approve allows for customizations by using custom actions and filters. You can 60 find out more about these by browsing the source code. 61 62 A commercial plugin that adds a config panel for customization is also available at 63 [https://newuserapprove.com/products/options-addon/](https://newuserapprove.com/products/options-addon/). 56 64 57 65 == Installation == … … 73 81 This is not a function of the plugin but of WordPress. WordPress provides the 74 82 *wp_mail_from* and *wp_mail_from_name* filters to allow you to customize this. 75 There are also a number of plugins that provide a setting to change this to 83 There are also a number of plugins that provide a setting to change this to 76 84 your liking. 77 85 78 86 * [wp mail from](http://wordpress.org/extend/plugins/wp-mailfrom/) 79 87 * [Mail From](http://wordpress.org/extend/plugins/mail-from/) 80 81 = Why is the password reset when approving a user? =82 83 The password is generated again because, by default, the user will not be aware84 of their password. By generating a new password, the email that notifies the85 user can also give them the new password just like the email does when receiving86 your password on a regular WordPress install. At approval time, it is impossible87 to retrieve the user's password.88 89 There is a filter available (new_user_approve_bypass_password_reset) to turn off90 this feature.91 88 92 89 = What happens to the user's status after the plugin is deactivated? = … … 105 102 106 103 == Changelog == 104 105 = 1.7.4 = 106 * Fixed: Corrected erroneous SQL query when filtering users 107 * Fixed: User filters 108 * Courtesy of [julmuell](https://github.com/julmuell) 109 * https://github.com/picklewagon/new-user-approve/pull/44 110 * Fixed: Show a user status in the filters only if at least one user has that status 107 111 108 112 = 1.7.3 =
Note: See TracChangeset
for help on using the changeset viewer.