Events Made Easy Forums How do I … Names in RSVP

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #54106
    Anonymous
    Inactive

    I am struggling a bit getting respondent names handled consistently.

    I the user is not logged in, no problem – I can just use the NAME field in the form and RESPNAME in output. User can fill in any name they want.

    If the user is logged in, what I would like is to use the user Display Name, but can’t see any way to do that. The default behaviour of using last name only is not very satisfactory – it is unusual to see people called by last name only, except footballers and politicians 🙂

    If I use separate FIRSTNAME and LASTNAME, the behaviour seems to be different depending whether login is required for the event. If login is not required and the user is logged in, the user first name and last name are populated In the form and can be output with RESPFIRSTNAME and RESPLASTNAME. But if login is required, the first name and last name are still filled in, but the username appears in output.

    I have not got as far as exploring what happens if the user has not set a first and last name.

    How is it supposed to work?

    Thanks in advance, Dave

    #54107
    Franky
    Keymaster

    If you want to use FIRSTNAME and LASTNAME, then also use it for non-logged in users (for consistency).
    Now, concerning the logic when creating the form fields, see this code snippet:

    
       if (is_user_logged_in()) {
          get_currentuserinfo();
          $bookerLastName=$current_user->user_lastname;
          if (empty($bookerLastName))
                   $bookerLastName=$current_user->display_name;
          $bookerFirstName=$current_user->user_firstname;
          $bookerEmail=$current_user->user_email;
       }
    

    When WP membership is required, then the lastname-field is readonly (in some cases also the firstname field, if you decide to use it: this is fixed in the next version as that can be empty).
    Also, when WP membership is required, the values in these fields are purely informative: when storing the booking, the info from the $current_user is taken for lastname/firstname too.
    The value for RESPLASTNAME should always be the same, regardless of requiring WP membership.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top