bbp_user_maybe_convert_pass

Convert passwords from previous platfrom encryption to WordPress encryption.

Description

bbp_user_maybe_convert_pass(); 

Usage

  1. if ( !function_exists( 'bbp_user_maybe_convert_pass' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/users/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bbp_user_maybe_convert_pass(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/users/functions.php  
  1. function bbp_user_maybe_convert_pass() { 
  2.  
  3. // Bail if no username 
  4. $username = !empty( $_POST['log'] ) ? $_POST['log'] : ''; 
  5. if ( empty( $username ) ) 
  6. return; 
  7.  
  8. global $wpdb; 
  9.  
  10. // Bail if no user password to convert 
  11. $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 ) ); 
  12. if ( empty( $row ) || is_wp_error( $row ) ) 
  13. return; 
  14.  
  15. // Setup admin (to include converter) 
  16. require_once(bbpress)->includes_dir . 'admin/admin.php' ); 
  17.  
  18. // Create the admin object 
  19. bbp_admin); 
  20.  
  21. // Convert password 
  22. require_once(bbpress)->admin->admin_dir . 'converter.php' ); 
  23. require_once(bbpress)->admin->admin_dir . 'converters/' . $row->meta_value . '.php' ); 
  24.  
  25. // Create the converter 
  26. $converter = bbp_new_converter( $row->meta_value ); 
  27.  
  28. // Try to call the conversion method 
  29. if ( is_a( $converter, 'BBP_Converter_Base' ) && method_exists( $converter, 'callback_pass' ) ) { 
  30. $converter->callback_pass( $username, $_POST['pwd'] );