Skip Navigation

[Resolved] Custom user fields prepopulated with other user data

This thread is resolved. Here is a description of the problem and solution.

Problem:

Display Custom user fields of current logged-in user.

Solution:

You need to setup attribute user_current='true' in Types shortocde.

For example:

[types usermeta='my-service-2' user_current='true'][/types]

Relevant Documentation:

https://toolset.com/documentation/customizing-sites-using-php/functions/

This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by Luo Yang 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1077613
Screen Shot 2018-08-08 at 21.58.30.png

Hello

I have created a set of user fields. Users can input data using a user form. The problem I have is that for new users the form is already populated with values from another user - the admin.

If you simply register at hidden link and after the registration view to the content template displaying the value of the fields at : hidden link you will see that the first fields are already populated with data (from a different user - the admin user) whilst they should be empty

The user form is here: hidden link

#1078283
user-form.JPG

Hello,

How do you setup the Toolset user form? is it a editing user form or creating user form?
If you are going to edit the current logged in user, you need to setup a Toolset form for editing user, and insert the form shortcode with option "The current logged in user", see screenshot: user-form.JPG

If the problem still persists, in case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2017, and test again

#1078292
Screen Shot 2018-08-09 at 07.46.34.png

Thank you

I have done as you instructed

1) The form was set up for editing the current logged in user - I double-checked
2) Switched the theme to 2017

The issue persists, please see the screenshot attached

#1078299

Please provide database dump file(ZIP file) of your website, also point out the problem page URL and form URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1078400

Thanks for the details, in the problem page:
hidden link, please edit it, in the post content, there are two kinds of shortcodes:
1) Views shortcode [wpv-user], for example:
[wpv-user field="user_firstname"]
It should be able to display the current logged-in user's first name

2) Types shortcode, for example:
[types usermeta='my-service-2' user_is_author='true'][/types]
the attribute "user_is_author" will output the user field value of the post author, in your case, you need another attribute:
user_current='true'

For example:
[types usermeta='my-service-2' user_current='true'][/types]

More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#address
click link "Repeater attributes, User attributes, Term attributes, Usage examples"
you will be able to see the example codes:
user meta shortcode:

[types usermeta='user-address' user_current='true'][/types]

Hope it is clear

#1078690

Thank you for the advice! Resolved the issue!

#1078816

You are welcome