Skip to:

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#4362 closed defect (bug) (fixed)

Registration Page Has Pre-Populated Fields

Reported by: shanebp Owned by: DJPaul
Milestone: 1.6 Priority: normal
Severity: normal Version:
Component: Component - XProfile Keywords: commit


Some registration fields are pre-populated with data from user_id = 0.

r-a-y workaround in register.php:

if ( bp_has_profile( 'user_id=-1&profile_group_id=1' ) ) :

djpaul - "Two problems here. One, this zero matching. The second is how zero user ID profle data gets put into the database."


And per:

Attachments (1)

4362.01.patch (508 bytes) - added by DJPaul 3 years ago.

Download all attachments as: .zip

Change History (7)

#1 @DJPaul
3 years ago

  • Component changed from Core to XProfile
  • Milestone changed from Awaiting Review to 1.6
  • Owner set to DJPaul
  • Status changed from new to assigned

#2 @DJPaul
3 years ago

The problem is easy to recreate if you change the user_id column to 0, of a record in the bp_xprofile_data table. I cannot find a way of deleting a user through wp-admin that, instead of deleting the user's profile data, does an UPDATE and sets the user_id to 0. That part we may have to come back to in the future/1.7 when we have more time to investigate.

4362.01.patch stops fetching xprofile data when user_id = 0. This was caused by bp_displayed_user_id() returning zero if no user is displayed or logged in. Suggest this for branch and trunk.

I tried to do something like this in the update_1_6() function to tidy up orphaned xprofile data, but most of BuddyPress isn't loaded. Maybe for a future release?

		// Delete orphaned xprofile data. See #4362.
		if ( bp_is_active( 'xprofile' ) )
			BP_XProfile_ProfileData::delete_data_for_user( 0 );

3 years ago

#3 @johnjamesjacoby
3 years ago

  • Keywords commit added

Patch looks good. Makes sense not to look for profile data on an empty ID.

#4 @djpaul
3 years ago

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

(In [6187]) Don't try to fetch profile data for user_id=0. Fixes #4362.

  • This fixes a problem where a (deleted) user's profile information was being shown on the registration template.
  • We still need to investigate why profile data record gets orphaned like this.

#5 @cnorris23
3 years ago

I noticed user_id = 0 on an install I've managed since 1.2 launched. I don't know if that's the case for shanebp. I was never able to track down the cause, but it only seemed to be happening in the early 1.2.x days, and it seemed like it was happening on registration, rather than a profile edit.

#6 @johnjamesjacoby
2 years ago

In 7488:

When loading profile fields for registration, do not attempt to fetch field data. See #4362.

Note: See TracTickets for help on using tickets.