WordPress.org

Plugin Directory

Changeset 605085


Ignore:
Timestamp:
09/28/12 08:48:07 (19 months ago)
Author:
picklewagon
Message:

add a filter to bypass password reset

Location:
new-user-approve/branches/1.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • new-user-approve/branches/1.4/new-user-approve.php

    r605084 r605085  
    302302        $user = new WP_User( $user_id ); 
    303303 
    304         // reset password to know what to send the user 
    305         $new_pass = wp_generate_password(); 
    306         $data = array( 
    307             'user_pass' => md5($new_pass), 
    308             'user_activation_key' => '', 
    309         ); 
    310         $where = array( 
    311             'ID' => $user->ID, 
    312         ); 
    313         $wpdb->update($wpdb->users, $data, $where, array('%s', '%s'), array('%d')); 
     304        $bypass_password_reset = apply_filters( 'new_user_approve_bypass_password_reset', __return_false ); 
     305         
     306        if ( ! $bypass_password_reset ) { 
     307            // reset password to know what to send the user 
     308            $new_pass = wp_generate_password(); 
     309            $data = array( 
     310                'user_pass' => md5($new_pass), 
     311                'user_activation_key' => '', 
     312            ); 
     313            $where = array( 
     314                'ID' => $user->ID, 
     315            ); 
     316            $wpdb->update($wpdb->users, $data, $where, array('%s', '%s'), array('%d')); 
     317        } 
    314318 
    315319        wp_cache_delete($user->ID, 'users'); 
     
    323327        $message  = sprintf(__('You have been approved to access %s', $this->plugin_id), get_option('blogname')) . "\r\n"; 
    324328        $message .= sprintf(__('Username: %s', $this->plugin_id), $user_login) . "\r\n"; 
    325         $message .= sprintf(__('Password: %s', $this->plugin_id), $new_pass) . "\r\n"; 
     329        if ( ! $bypass_password_reset ) { 
     330            $message .= sprintf(__('Password: %s', $this->plugin_id), $new_pass) . "\r\n"; 
     331        } 
    326332        $message .= get_option('siteurl') . "/wp-login.php\r\n"; 
    327333 
  • new-user-approve/branches/1.4/readme.txt

    r605084 r605085  
    4747* [Mail From](http://wordpress.org/extend/plugins/mail-from/) 
    4848 
     49= Why is the password reset when approving a user = 
     50 
     51The password is generated again because, by default, the user will not be aware 
     52of their password. By generating a new password, the email that notifies the 
     53user can also give them the new password just like the email does when recieving 
     54your password on a regular WordPress install. 
     55 
     56There is a filter available (new_user_approve_bypass_password_reset) to turn off 
     57this feature. 
     58 
    4959== Screenshots == 
    5060 
     
    5767* honor the redirect if there is one set when registering 
    5868* add actions for when a user is approved or denied 
     69* add a filter to bypass password reset 
    5970 
    6071= 1.3.5 = 
Note: See TracChangeset for help on using the changeset viewer.