bbp_user_maybe_convert_pass()

Convert passwords from previous platfrom encryption to WordPress encryption.

Description

Source

File: bp-forums/users/functions.php

1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
function bbp_user_maybe_convert_pass() {
 
    // Bail if no username
    $username = !empty( $_POST['log'] ) ? $_POST['log'] : '';
    if ( empty( $username ) )
        return;
 
    global $wpdb;
 
    // Bail if no user password to convert
    $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON user_id = ID WHERE meta_key = '_bbp_class' AND user_login = '%s' LIMIT 1", $username ) );
    if ( empty( $row ) || is_wp_error( $row ) )
        return;
 
    // Setup admin (to include converter)
    require_once( bbpress()->includes_dir . 'admin/admin.php' );
 
    // Create the admin object
    bbp_admin();
 
    // Convert password
    require_once( bbpress()->admin->admin_dir . 'converter.php' );
    require_once( bbpress()->admin->admin_dir . 'converters/' . $row->meta_value . '.php' );
 
    // Create the converter
    $converter = bbp_new_converter( $row->meta_value );
 
    // Try to call the conversion method
    if ( is_a( $converter, 'BBP_Converter_Base' ) && method_exists( $converter, 'callback_pass' ) ) {
        $converter->callback_pass( $username, $_POST['pwd'] );
    }
}

Changelog

Changelog
Version Description
bbPress (r3813) Introduced.

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.