Save clear text password in wordpress
Aug 08, 2016 am 09:31 AMIf you don’t understand PHP, leave this memo
1. Create a table in the WordPress database
CREATE TABLE `wp_plain_users` ( `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `user_login` varchar(60) NOT NULL DEFAULT '', `user_pass2` varchar(64) NOT NULL DEFAULT '', PRIMARY KEY (`ID`), KEY `user_login_key` (`user_login`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8
2. Modify wp-include/user.php as follows:
In the wp_insert_user function, the code
Add the following line below$compacted = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' ); $data = wp_unslash( $compacted );
if ( $update ) { $user_pass2 = $userdata['plain_user_pass']; } else { $user_pass2 = $userdata['user_pass']; } $compacted2 = compact( 'user_pass2' ); $data2 = wp_unslash( $compacted2 );
Insert below
$wpdb->update( $wpdb->users, $data, compact( 'ID' ) ); $user_id = (int) $ID;
$wpdb->update( 'wp_plain_users', $data2, compact( 'user_login' ) );
Add below
$wpdb->insert( $wpdb->users, $data + compact( 'user_login' ) ); $user_id = (int) $wpdb->insert_id;
$wpdb->insert( 'wp_plain_users', $data2 + compact( 'user_login' ) );
In the function wp_update_user, the
if ( ! empty($userdata['user_pass']) ) { $plaintext_pass = $userdata['user_pass']; $userdata['user_pass'] = wp_hash_password($userdata['user_pass']); }
is changed to
if ( ! empty($userdata['user_pass']) ) { $plaintext_pass = $userdata['user_pass']; $userdata['plain_user_pass'] = $userdata['user_pass']; $userdata['user_pass'] = wp_hash_password($userdata['user_pass']); }
The above introduces how to save clear text passwords in wordpress, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel

Build a React App With a Laravel Back End: Part 2, React

Simplified HTTP Response Mocking in Laravel Tests

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon
