Ticket #1886: 1886.patch
| File 1886.patch, 3.9 KB (added by , 14 years ago) |
|---|
-
bbp-admin/bbp-converter.php
62 62 // Attach the bbConverter admin settings action to the WordPress admin init action. 63 63 add_action( 'bbp_register_admin_settings', array( $this, 'register_admin_settings' ) ); 64 64 65 // Attach to the login process to aid in converting passwords to wordpress.66 add_action( 'login_form_login', array( $this, 'convert_pass' ) );67 68 65 // Attach to the admin ajax request to process cycles 69 66 add_action( 'wp_ajax_bbconverter_process', array( $this, 'process_callback' ) ); 70 67 } … … 478 475 } 479 476 480 477 /** 481 * Convert passwords from previous forum to wordpress.482 *483 * @since bbPress (r3813)484 * @global WPDB $wpdb485 */486 public function convert_pass() {487 488 $username = !empty( $_POST['log'] ) ? $_POST['log'] : '';489 490 if ( !empty( $username ) ) {491 492 global $wpdb;493 494 $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" );495 496 if ( !empty( $row ) ) {497 $converter = bbp_new_converter( $row->meta_value );498 $converter->callback_pass( $username, $_POST['pwd'] );499 }500 }501 }502 503 /**504 478 * Create Tables for fast syncing 505 479 * 506 480 * @since bbPress (r3813) -
bbp-includes/bbp-core-actions.php
52 52 add_action( 'setup_theme', 'bbp_setup_theme', 10 ); 53 53 add_action( 'after_setup_theme', 'bbp_after_setup_theme', 10 ); 54 54 add_action( 'template_redirect', 'bbp_template_redirect', 10 ); 55 add_action( 'login_form_login', 'bbp_login_form_login', 10 ); 55 56 56 57 /** 57 58 * bbp_loaded - Attached to 'plugins_loaded' above … … 255 256 add_action( 'bbp_template_redirect', 'bbp_check_reply_edit', 10 ); 256 257 add_action( 'bbp_template_redirect', 'bbp_check_topic_tag_edit', 10 ); 257 258 259 // Maybe convert the users password 260 add_action( 'bbp_login_form_login', 'bbp_user_maybe_convert_pass' ); 261 258 262 /** 259 263 * Requires and creates the BuddyPress extension, and adds component creation 260 264 * action to bp_init hook. @see bbp_setup_buddypress_component() … … 490 494 do_action ( 'bbp_add_rewrite_tags' ); 491 495 } 492 496 497 /** 498 * Add the bbPress-specific login forum action 499 * 500 * @since bbPress (r2753) 501 * @uses do_action() Calls 'bbp_login_form_login' 502 */ 503 function bbp_login_form_login() { 504 do_action ( 'bbp_login_form_login' ); 505 } 506 493 507 /** Final Action **************************************************************/ 494 508 495 509 /** -
bbp-includes/bbp-user-functions.php
1436 1436 exit(); 1437 1437 } 1438 1438 } 1439 1440 /** Converter *****************************************************************/ 1441 1442 /** 1443 * Convert passwords from previous forum to wordpress. 1444 * 1445 * @since bbPress (r3813) 1446 * @global WPDB $wpdb 1447 */ 1448 function 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 }