Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/08/2012 10:48:17 AM (9 years ago)
Author:
johnjamesjacoby
Message:

Converter:

  • Move convert_pass method into global scope, so passwords are converted anywhere.
  • Fixes #1886.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-user-functions.php

    r4050 r4072  
    14371437    }
    14381438}
     1439
     1440/** Converter *****************************************************************/
     1441
     1442/**
     1443 * Convert passwords from previous platfrom encryption to WordPress encryption.
     1444 *
     1445 * @since bbPress (r3813)
     1446 * @global WPDB $wpdb
     1447 */
     1448function bbp_user_maybe_convert_pass() {
     1449
     1450    // Bail if no username
     1451    $username = !empty( $_POST['log'] ) ? $_POST['log'] : '';
     1452    if ( empty( $username ) )
     1453        return;
     1454
     1455    global $wpdb;
     1456
     1457    // Bail if no user password to convert
     1458    $row = $wpdb->get_row( "SELECT * FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON user_id = ID WHERE meta_key = '_bbp_converter_class' AND user_login = '{$username}' LIMIT 1" );
     1459    if ( empty( $row ) || is_wp_error( $row ) )
     1460        return;
     1461
     1462    // Convert password
     1463    require_once( bbpress()->admin->admin_dir . 'bbp-converter.php' );
     1464    require_once( bbpress()->admin->admin_dir . 'converters/' . $row->meta_value . '.php' );
     1465
     1466    // Create the converter
     1467    $converter = bbp_new_converter( $row->meta_value );
     1468
     1469    // Try to call the conversion method
     1470    if ( is_a( $converter, 'BBP_Converter_Base' ) && method_exists( $converter, 'callback_pass' ) ) {
     1471        $converter->callback_pass( $username, $_POST['pwd'] );
     1472    }
     1473}
Note: See TracChangeset for help on using the changeset viewer.