Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field Value not displayed if field name is "title" #206

Open
3 tasks done
ipokkel opened this issue Feb 23, 2021 · 3 comments
Open
3 tasks done

Field Value not displayed if field name is "title" #206

ipokkel opened this issue Feb 23, 2021 · 3 comments

Comments

@ipokkel
Copy link
Member

ipokkel commented Feb 23, 2021

Describe the bug
When a custom field's name, and meta key, is title and the option to display the field in the profile is set to true the field is shown "empty" while data exist in the user meta table for this key.
The field value is displayed as expected except on the user profile edit page in the administrative area.

To Reproduce
Steps to reproduce the behavior:

  1. Create a custom registration text field named title and set option 'profile' => true, (sample recipe)
  2. Register new member and complete the custom registration field during checkout.
  3. In the administrative area, navigate to Users > All Users and select user to view details.
  4. Scroll down to "More Information" section to view "Title" field, field value is empty.
  5. Check front end profile page, export memberslist csv and database to confirm a value for this meta key exists.
  6. Load custom meta field display code to verify that meta key name is not reserved by WP

Expected behavior
Field's value displays in the input field for the title field.

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only Paid Memberships Pro plugin is active.
  • This bug happens with a default WordPress theme active, or Memberlite.
  • I can reproduce this bug consistently using the steps above.
@ipokkel
Copy link
Member Author

ipokkel commented Feb 24, 2021

As a temporary workaround an additional field, that will only display for administrators, may be added below this field to display the value of this field.

/*
	Temporary workaround to display the value of the "title" field in the administrative area
	on the user edit profile page.
	*/
	if ( is_admin() && empty( $user_id ) && isset( $_REQUEST['user_id'] ) ) {
		$user = get_user_by( 'id', $_REQUEST['user_id'] );
	}
	$fields[] = new PMProRH_Field(
		'display_title_value', // input field name, used as meta key
		'readonly',          // field type
		array(
			'label'   => 'Title Value', // field label
			'hint'    => '<br /><em>Display value of Title field above *(Temp workaround for RH not displaying title field)</em>',
			'profile' => 'only_admin',            // display on user profile
			'value'   => get_user_meta( $user->ID, 'title', true ),
		)
	);

@ipokkel
Copy link
Member Author

ipokkel commented Dec 6, 2021

Another occurrence of this issue was reported here: moderators only

@ipokkel
Copy link
Member Author

ipokkel commented Dec 7, 2021

title is reserved for internal WordPress usage - https://codex.wordpress.org/Reserved_Terms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant