Support » Plugin: WP-Members Membership Plugin » Display name value not showing in user update form

  • I have added the display_name field to the wp-members registration form so a user can set his or her display name through the wp-members registration form. This works fine and the Display Name shows up correctly in places where it is used.

    Except, when the user returns to the wp-members form for editing his/her profile, when the display_name field appears blank.

    I have managed to track this problem down to an error in your code for the function wpmem_inc_registration which is included in the source file /inc/forms.php

    In lines 1269-1302 of this file, the code is supposed to fetch existing values of fields that may be edited but fails to recognise that the value of display_name must be retrieved as a native field, not as meta data.

    I have copied this function into the functions.php file in my theme and added the following lines to this section:

    case ('display_name') :
    	$val = $userdata->display_name;
    	break;

    and this fixes the problem.

    Would be grateful if you could check this out and add the bug fix to a futire release.

    https://wordpress.org/plugins/wp-members/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    Thanks for mentioning this. Yes, that will be included in the next update.

    I see you have implemented this update at v 3.0.7.2 but note you have put the display name through htmlspecialchars before assigning it to $val. Can you explain the reasoning behind this?

    It now means that if a user uses a special char in his or her profile, e.g. aenea & co
    then, although that displays ok as ‘aenea & co’, when the user goes to the profile update form, it is rendered as ‘aenea & co’, which could confuse the user.

    If htmlspecialchars is not used, however, it displays as ‘aenea & co’ in the form.

    I haven’t found any problems by not using htmlspecialchars here but wonder if I am missing something.

    Plugin Author Chad Butler

    (@cbutlerjr)

    The reasoning is that the input from the user needs to be filtered to avoid exploits.

    I’ll consider changing it, but can’t guarantee that I’ll come to a positive conclusion on that. But it may be that using sanitize_text_field() is more appropriate.

    Yes, using sanitize_text_field is a good idea. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display name value not showing in user update form’ is closed to new replies.