BBP_Converter_Base::callback_pass( string $username, string $password )
Run password through wp_hash_password()
Description
Parameters
- $username
-
(Required)
- $password
-
(Required)
Source
File: bp-forums/admin/converter.php
public function callback_pass( $username, $password ) {
$user = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT * FROM ' . $this->wpdb->users . ' WHERE user_login = "%s" AND user_pass = "" LIMIT 1', $username ) );
if ( !empty( $user ) ) {
$usermeta = $this->wpdb->get_row( 'SELECT * FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_password" AND user_id = "' . $user->ID . '" LIMIT 1' );
if ( !empty( $usermeta ) ) {
if ( $this->authenticate_pass( $password, $usermeta->meta_value ) ) {
$this->wpdb->query( 'UPDATE ' . $this->wpdb->users . ' ' . 'SET user_pass = "' . wp_hash_password( $password ) . '" ' . 'WHERE ID = "' . $user->ID . '"' );
$this->wpdb->query( 'DELETE FROM ' . $this->wpdb->usermeta . ' WHERE meta_key = "_bbp_password" AND user_id = "' . $user->ID . '"' );
}
}
}
}
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.