Skip to:
Content

bbPress.org

Opened 12 years ago

Closed 11 years ago

#1886 closed defect (bug) (fixed)

phpBB Imported User Passwords

Reported by: netweb's profile netweb Owned by:
Milestone: 2.2 Priority: normal
Severity: normal Version: 2.1
Component: API - Importers Keywords:
Cc: lmoffereins@…

Description

Users imported from phpBB are unable to login using the migrated password.

The behavior exists when trying to login via the bbPress login widget or directly via /wp-admin/

Attachments (3)

1886.patch (3.9 KB) - added by johnjamesjacoby 12 years ago.
1886-2.diff (957 bytes) - added by netweb 12 years ago.
CamelCase.diff (1.4 KB) - added by netweb 12 years ago.

Download all attachments as: .zip

Change History (30)

#1 @johnjamesjacoby
12 years ago

  • Keywords reporter-feedback added

It'd be great if you could test the attached patch. It moves the conversion out of the converter class, and into the global scope.

#2 @johnjamesjacoby
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4072]) Converter:

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

#3 @netweb
12 years ago

Thanks, I will in the morning ~12:00am here at the moment ;)

#4 @netweb
12 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Nope, still not working for either the widget or /wp-admin areas to login with.

The password (both before and after this patch) is getting converted/stored into _usermeta._bbp_password and as per the import process the password in _users.user_pass is nulled.

#5 @xiosen
12 years ago

  • Keywords needs-patch added; reporter-feedback removed
  • Version changed from 2.0 to 2.1

The variable appears to have been renamed. To fix this change line 1458 in the bbp_user_maybe_convert_pass() function from:

	// Bail if no user password to convert
	$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" );
	if ( empty( $row ) || is_wp_error( $row ) )
		return;

To:

	// Bail if no user password to convert
	$row = $wpdb->get_row( "SELECT * FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON user_id = ID WHERE meta_key = '_bbp_class' AND user_login = '{$username}' LIMIT 1" );
	if ( empty( $row ) || is_wp_error( $row ) )
		return;

#6 @xiosen
12 years ago

Found another issue. The next lines in the code (bbpress()->admin->admin_dir) return null because the admin has not been setup yet by the time this code runs. I changed:

	// Convert password
	require_once( bbpress()->admin->admin_dir . 'bbp-converter.php' );
	require_once( bbpress()->admin->admin_dir . 'converters/' . $row->meta_value . '.php' );

To:

	//Setup admin
	require_once( bbpress()->plugin_dir . 'bbp-admin/bbp-admin.php' );

	bbp_admin();

	// Convert password
	require_once( bbpress()->admin->admin_dir . 'bbp-converter.php' );
	require_once( bbpress()->admin->admin_dir . 'converters/' . $row->meta_value . '.php' );

I had the same issue you had but with Invision instead and these changes fixed it.

Last edited 12 years ago by xiosen (previous) (diff)

@netweb
12 years ago

@netweb
12 years ago

#7 @netweb
12 years ago

Correct phpBB.php & vBulletin.php class variable/file names CamelCase.diff

#8 @netweb
12 years ago

  • Milestone changed from 2.1 to 2.1.1

#9 @johnjamesjacoby
12 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [4089]) Converter:

  • Tweak bbp_user_maybe_convert_password() with correct meta key.
  • Include missing BBP_Admin() class
  • Fixes #1886 (2.2 branch).
  • Props netweb, xiosen.

#10 @johnjamesjacoby
12 years ago

(In [4090]) Converter:

  • Tweak bbp_user_maybe_convert_pass() with correct meta key.
  • Include missing BBP_Admin() class
  • Fixes #1886 (2.1 branch).
  • Props netweb, xiosen.

#11 @netweb
12 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

http://bbpress.trac.wordpress.org/attachment/ticket/1886/CamelCase.diff Needs to also be committed for users logging in needing a password lookup.

#12 @johnjamesjacoby
12 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [4101]) Converters:

  • Classes are case sensitive when being loaded by the main converter.
  • Fixes #1886.
  • Props netweb.

#13 @johnjamesjacoby
12 years ago

(In [4102]) Converters:

  • Revert whitespace changes in r4101.
  • See #1886.
  • Antiprops netweb.

#14 @johnjamesjacoby
12 years ago

  • Milestone changed from 2.1.1 to 2.1.2
  • Resolution fixed deleted
  • Status changed from closed to reopened

Missed the 2.1.1 release. Moving to 2.1.2.

#15 @johnjamesjacoby
12 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [4119]) Converters:

  • Classes are case sensitive when being loaded by the main converter.
  • Fixes #1886.
  • For 2.1 branch.
  • Props netweb.

#16 @netweb
12 years ago

  • Keywords needs-patch removed
  • Milestone changed from 2.1.2 to 2.1.3

Tried & Tested, adding to 2.1.3

#17 @Offereins
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Browsing Trunk I can't find how this/my problem is solved (using 2.1.2 on 3.4.2). After a succesfull conversion from phpBB, my users want to login. After entering their login en password, hitting submit leads them through the wp-login.php page where they get bumped with a number of Undefined index: var_name messages - concerning the first four lines of BBP_Converter_Base::setup_globals() - concluding with a notice that the database connection failed. That is about the $this->opdb = new wpdb([...]) line.

Hooking in the bbp_login_form_login action just before bbp_user_maybe_convert_pass does, gets rid of the problem, using the following code:

function workaround_bbp_login(){
	// Setup fields as {name} => {value}
	$fields = array( 
		'_bbp_converter_rows'      => 0,
		'_bbp_converter_db_user'   => 'xxxx',
		'_bbp_converter_db_pass'   => 'xxxx',
		'_bbp_converter_db_name'   => 'xxxx',
		'_bbp_converter_db_server' => 'xxxx',
		'_bbp_converter_db_prefix' => 'xxxx'
		);

	// Set $_POST fields
	foreach ( $fields as $name => $value )
		if ( !isset( $_POST[$name] ) )
			$_POST[$name] = $value;
}

Where 'xxxx' represents actual values so the DB connection doesn't fail.

A better solution could be found in the answer to this question: Do we really need an extra database connection with $this->opdb = new wpdb([...]), while we only create an instance of this class to use the callback_pass method for the password authentication? Me thinks not.

#18 @johnjamesjacoby
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Try the 2.1 branch of code; it's not fixed in a public release yet. The code in /trunk and /branches/2.1/ is fixed.

Reopen if it's still not working after switching to either of those versions.

#19 @Offereins
11 years ago

  • Cc lmoffereins@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened

I'm sorry, but no. Neither /trunk nor /branches/2.1/ has solved the problem. My issue may well be another problem than this tickets', though it concerns the same files.

The errors for two identical situations (user, roles, plugins etc.):

Branches 2.1 4163

Notice: Trying to get property of non-object in {domain}/wp-content/plugins/bbpress/bbp-includes/bbp-user-functions.php on line 1466

Warning: require_once(bbp-converter.php) [function.require-once]: failed to open stream: No such file or directory in {domain}/wp-content/plugins/bbpress/bbp-includes/bbp-user-functions.php on line 1466

Fatal error: require_once() [function.require]: Failed opening required 'bbp-converter.php' (include_path='.:/usr/share/pear') in {domain}/wp-content/plugins/bbpress/bbp-includes/bbp-user-functions.php on line 1466

Trunk 2.1 4241

Notice: Undefined index: _bbp_converter_rows in {domain}/wp-content/plugins/bbpress/bbp-admin/bbp-converter.php on line 592

Notice: Undefined index: _bbp_converter_db_user in {domain}/wp-content/plugins/bbpress/bbp-admin/bbp-converter.php on line 593

Notice: Undefined index: _bbp_converter_db_pass in {domain}/wp-content/plugins/bbpress/bbp-admin/bbp-converter.php on line 593

Notice: Undefined index: _bbp_converter_db_name in {domain}/wp-content/plugins/bbpress/bbp-admin/bbp-converter.php on line 593

Notice: Undefined index: _bbp_converter_db_server in {domain}/wp-content/plugins/bbpress/bbp-admin/bbp-converter.php on line 593

Warning: mysql_connect() [function.mysql-connect]: Access denied for user '{user}'@'localhost' (using password: NO) in {domain}/wp-includes/wp-db.php on line 1038

Who's out there for the rescue?

#20 follow-up: @netweb
11 years ago

You will need to run the import wizard again with the updated version of bbPress you are using.

#21 in reply to: ↑ 20 @johnjamesjacoby
11 years ago

  • Milestone changed from 2.1.3 to 2.2

Related: #1969.

#22 @netweb
11 years ago

  • Milestone changed from 2.3 to 2.2

Have tested this again just now and is working fine for phpBB imported users.

Pretty sure this ticket can now be closed, the issue with @Offereins above is that you need to do a clean import for this to work, you could not import with 2.1.2 and then patch with /trunk or 2.1x branch and have users successfully login.

#23 @johnjamesjacoby
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Great. Closing as fixed.

#24 @Ruuttu
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I'm sorry to say there are still problems.

I imported a bunch of users with bbPress 2.3-rc1 and confirmed that I was able to login to them. Then, when I deleted those users and imported some more, they wouldn't allow logging in anymore. Same error with "Undefined index: _bbp_converter_rows" and so on and database connection failed.

#25 @netweb
11 years ago

@Ruuttu

I am not sure what you are trying to achieve in the way you are going about importing the users, why not just import them in one single import?

The error "Undefined index: _bbp_converter_rows" you state 'same error', did you have this error previously?

#26 @Ruuttu
11 years ago

I meant the "same error" Offereins was describing before. I can imagine use cases where you'd need to import users several times. In my case I'm developing a custom importer and testing it is really frustrating as I'm forced to re-install the entire WordPress instance after each import.

#27 @netweb
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

I'm closing this ticket as writing a custom importer for bbPress has nothing to do with this phpBB ticket.

If you are having troubles writing a custom importer for bbPress please create a new ticket.

Note: See TracTickets for help on using tickets.