I am trying to use a View to get an ID that I use in the item= element of a Types field - like below:
This works as expected:
[types field='first-name' item='503'][/types]
This doesnt.
[types field='first-name' item='[wpv-view name="member-profile-id"]'][/types]
The view work on its own an outputs the correct ID number.
[wpv-view name="member-profile-id"]
Combining them together doesn't output anything.
Results:
ID number: [types field='first-name' item='506'][/types]
<br>
Types with view: [types field='first-name' item='[wpv-view name="member-profile-id"]'][/types]
<br>
Member profile ID: [wpv-view name="member-profile-id"]
----
ID number: Stuart
view:
Member profile ID: 506
What I am trying to do is prefill a CRED form with a custom post profile person name (not a user name) when they submit the form.
The 'member' has a 'profile', and on the profile, there are a number of custom fields that I need to pull, e.g fist name, last name.
However, I need to get the ID of the individual's profile first to be able to reference the field to get the data.
I am sure there is something obvious that's stopping it ...
help 🙂
Cheers
Hello,
The "item" attribute does not support [wpv-view] shortcode:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
Since [wpv-view] shortcode will output extra HTML tags in the result, so you can not use it as "item" attribute, I suggest you display the custom field value in post view "member-profile-id" directly.
Hmm, that's a shame as it would be quite useful.
My workaround ( for my reference and anyone else), while a view shortcode doesn't work in the 'item' attribute what I can do instead is use a types usermeta shortcode in the item attribute - which does work.
[types field='first-name' item="[types usermeta='activated' current_user='true'][/types]"][/types]
When I first create the member profile I will store this reference ID on the user meta and I can then easily reference it.
This should work ok.
There is always a workaround!
cheers!