0

Can anyone tel me if a plug-in exists that can do the following:

  1. Check is it's the users first visit, if so the user will be prompted to input their first name into a text field. Their name will then by dynamically displayed within the sites content. EG: Hi [firstname]
  2. Display the users first name if the user has previously visited.

I've searched for 'dynamic text' and 'personalization' but I'm not seeing anything. Any recommendations?

0

Use wp_get_current_user to get the current user (if any) then check or update the display name - update_user_meta or wp_update_user.

When you have a user, you'll probably want to set a flag on the user's meta for after they have filled out their name, or prompt otherwise.

How/where all this would go is really a more complex discussion than the root of getting and setting the data. Most likely this should be done via AJAX so the initial page is rendered, and the hello decorates it after the fact.

  • This will only work if the user creates an account and signs in. – rudtek Apr 10 '17 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.