Skip Navigation

[Resolved] Unable to display custom usermeta field value using toolset shortcode

This support ticket is created 5 years, 1 month 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 5 replies, has 2 voices.

Last updated by jonB-5 5 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1372241
Screenshot 2019-10-29 at 12.26.06.png
Screenshot 2019-10-29 at 12.24.28.png
Screenshot 2019-10-29 at 12.23.57.png

I am trying to output a usermeta field using the following shortcode generated by Types:
[types usermeta='member-email-verified' current_user='true'][/types]

I have tried with "user_current" instead of "current_user", as per the documentation at https://toolset.com/documentation/customizing-sites-using-php/functions/#radio but this did not resolve the issue.

I have also tried the shortcode with output="raw" but this did not resolve the issue.

To recreate, head to hidden link and set up a test account. The page it directs you to will show the text "() Your Associate member account request is pending.". The shortcode should output the field value between the brackets.

#1372331

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Can I get access to the backend to look at how you have this set up?

I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

#1372345

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I don't need FTP.

But the username/password combination you supplied didn't work.

Can you edit your last reply and update?

#1372347

I've just edited the previous post with the new password.

J.

#1372377

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2019-10-29 at 14.10.21.png

I created a test user and then edited your page so that it simply outputs the value of the user custom field using

[types usermeta='member-email-verified' current_user='true'][/types]

and it works. I updated your shortcode that is wrapped in the conditional shortcode to match, and it also works. See the screenshot.

In both cases, '1' is being output.

That is the saved value of the field.

If you want to display something else, e.g. the same text as the label, then you should specify that text in the settings, under "Show one of these values", so that when the value is 1 it shows "Email has NOT been verified", or whatever is appropriate.

The test user with username tssupp can be deleted when you have confirmed how it works.

#1372415

Thanks for your assistance Nigel, the issue still persisted for me even after the above changes to the shortcode & conditionals. I had found it to be intermittent, working for a while and then not after a while with no code changes made.

I think the issue was that despite the default field value being specified, the field was not included in the user registration form or in the php for when the form was submitted. My guess is that that meant the default field value displayed when looking at the user meta in wp-admin but that it wasn't actually saved to the database when the user was created.