Skip Navigation

[Resolved] Toolset Communication System – how to change default fields FN and LN on my own?

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

Problem: I would like to display some custom user fields instead of the standard first name and last name fields in the message module.

Solution: The User ID is included in the message-to field, so you can use it in a Types usermeta shortcode like so:

[types usermeta='your-field-slug' user_id='[types field="message-to"][/types]']

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

This support ticket is created 4 years, 9 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Serhii 4 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1550613

Hello, I want to implement toolset communication system on my site - hidden link

I have done this instruction - https://toolset.com/learn/how-to-create-a-messaging-system-with-toolset/ and all works fine but I want to change some things. Can you help me please?

By default inside views "Messages sent" and "Messages received" are used default wordpress user fields "First Name" and "Last Name" - hidden link , hidden link , hidden link

I need to use my own custom fields: name, surname or nickname and avatar(image) instead default WP fields "First Name" and "Last Name". How can I do it?

#1551593

Hello, it looks like you want to replace this fields:

[wpv-user field='user_firstname' id="[types field='message-to'][/types]"]
[wpv-user field='user_lastname' id="[types field='message-to'][/types]"]

Note that the ID of the User you want to display is contained in the message-to field. So you can use that same information in the user_id attribute of the Types usermeta field like so:

[types usermeta='your-field-slug' user_id='[types field="message-to"][/types]']

Replace your-field-slug with the slug of the field you want to display. This is would be useful to display a simple text field. If you want to display something like an image field, you will use the same attributes usermeta and user_id, but you can add more attributes to resize the image, align, crop it, etc. You can consult the documentation here for more examples and display options: https://toolset.com/documentation/customizing-sites-using-php/functions/#image
Click "+More" to see more examples of User fields.

[types usermeta="image-field-slug" user_id="[types field='message-to'][/types]"][/types]

Let me know if this doesn't work as expected, or if I misunderstood what you want to accomplish.

#1553101

My issue is resolved now. Thank you!