Skip Navigation

[Resolved] Split: Edit a Custom Post in frontend

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

Problem:

The issue here is that the user wanted to add the name of users whose id's are stored in a custom field to a mail when a post created in Toolset Form

Solution:

To add the user's first and Last name to the email based on the ID being passed into the custom field you can use the following.

[wpv-user field="user_firstname" id="[wpv-post-field name='user-select' id='%%POST-ID%%']"]
 
[wpv-user field="user_lastname" id="[wpv-post-field name='user-select' id='%%POST-ID%%']"]

Now in this case the user's ID was being stored in the field called user-select.

This support ticket is created 6 years 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 9 replies, has 2 voices.

Last updated by simonR-7 6 years ago.

Assisted by: Shane.

Author
Posts
#1195636

I use in a Post Form a user-select option to redirect the form to another user:

[cred_generic_field type='select' field='user-select']
{
"required":1,
"options":[ [wpv-view name="user-list"] ],
"generic_type":"user_id",
"persist":1
}

How can I add in the email notification as a text field the selected user.
I can do this in the header, so the user will get an email notification but I want to enclude it also as a text field, or a header (to)

For example; Dear [selected user in the form]

#1195658

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

For the notification what you can try doing is this.
Add this to your notifications.

[wpv-post-field name='user-select' id='%%POST_ID%%']

Please try this and let me know if it helps.

Thanks,
Shane

#1195879

I would like to see the user first name, last name and a custom field department (I have it made). If I use POST-ID as you mentioned, I only get the ID as a number.

Do I need to change the view 'user-list'?

#1195988

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

Could you send me the contents of your view ?
It seems that the view is only getting ID of the user.

Thanks,
Shane

#1195995

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-item index=1]{"value":"[wpv-user field="ID"]","label":"[wpv-user field="user_firstname"] [wpv-user field="user_lastname"] [types usermeta='afdeling' separator=', '][/types]"}
[wpv-item index=other],{"value":"[wpv-user field="ID"]","label":"[wpv-user field="user_firstname"] [wpv-user field="user_lastname"] [types usermeta='afdeling' separator=', '][/types]"}
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[/wpv-no-items-found]
[wpv-layout-end]

#1196009

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

I see the issue, we are passing the ID as the value of the field.

Try using it like this.

[wpv-item index=1]{"value":"[wpv-user field="user_firstname"] [wpv-user field="user_lastname"] ","label":"[wpv-user field="user_firstname"] [wpv-user field="user_lastname"] [types usermeta='afdeling' separator=', '][/types]"}
[wpv-item index=other],{"value":"[wpv-user field="user_firstname"] [wpv-user field="user_lastname"] ","label":"[wpv-user field="user_firstname"] [wpv-user field="user_lastname"] [types usermeta='afdeling' separator=', '][/types]"}

This should now give your desired results.

Please let me know.

Thanks,
Shane

#1196015

How do I change it in the form? Because it's not working and the reciever doesn't get the email.

[cred_generic_field type='select' field='user-select']
				{
					"required":1,
					"options":[ [wpv-view name="user-list"] ],
					"generic_type":"user_id",
					"persist":1
				}
		[/cred_generic_field]
#1196042

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

Is this the same view that Diego had assisted you with previously ?

If so I would restore it back to its original functionality. Sorry for not realising this earlier.

Restore it to its original state before I started assisting by just re-adding this.

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-item index=1]{"value":"[wpv-user field="ID"]","label":"[wpv-user field="user_firstname"] [wpv-user field="user_lastname"] [types usermeta='afdeling' separator=', '][/types]"}
[wpv-item index=other],{"value":"[wpv-user field="ID"]","label":"[wpv-user field="user_firstname"] [wpv-user field="user_lastname"] [types usermeta='afdeling' separator=', '][/types]"}
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[/wpv-no-items-found]
[wpv-layout-end]

This view is meant to pass data for another field.

I believe it would be best for me to have a look at the site so that I can fully understand everything this way we don't lose previously implemented functionalities.

Thanks,
Shane

#1196095

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

I see now what you're trying to achieve.

Could you use this shortcode.

[wpv-user field="user_firstname" id="[wpv-post-field name='user-select' id='%%POST-ID%%']"]

[wpv-user field="user_lastname" id="[wpv-post-field name='user-select' id='%%POST-ID%%']"]

This should work given that your form is storing the ID of the selecting user in the user-select field.

Thanks,
Shane

#1196314

My issue is resolved now. Thank you!