Skip Navigation

[Resolved] I need a User’s custom Image field to become their post’s featured image

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

Problem:
I need a User's custom Image field to become their post's featured image

Solution:
You should use the save_post action hook to automatically assign the custom user image field as post thumbnail. Please check how you can use save_post with the following doc:
=> https://toolset.com/documentation/customizing-sites-using-php/updating-types-fields-using-php/

You can find the proposed solution in this case with the following reply:
=> https://toolset.com/forums/topic/i-need-a-users-custom-image-field-to-become-their-posts-featured-image/#post-1967961

Relevant Documentation:

This support ticket is created 3 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.

Our next available supporter will start replying to tickets in about 0.03 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by andrewD-10 3 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1967289

Hi Toolset,

I have a user's custom image field called "Company Logo".
I am allowing users to post on my website and for each of their posts I would want their "Company Logo" to be the post's featured image.

I am not sure what custom code I need to be able to have the User's Company Logos be the Featured Image on all the posts they are authors of.

Please help if you can.

#1967515

Here is a video to help explain: hidden link

#1967961

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You should use the save_post action hook to automatically assign the custom user image field as post thumbnail. Please check how you can use save_post with the following doc:
=> https://toolset.com/documentation/customizing-sites-using-php/updating-types-fields-using-php/

Please check the following link that may help you:
- https://wordpress.stackexchange.com/questions/295247/automatically-set-the-featured-image

If you are not sure yet, please share for what post types you want to assign the user custom field image as featured image and share admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1974893

Hi Minesh,

I found an article that allows me to have a custom Image field for the user show up on each of the user's posts that they author. Although it is not the feature image, it is rather through a short code.

If I go to edit the post content on the top there is a selection for "Fields and Views" I select it and select the custom image field for the user (Company Logo). Then I set it to show the "Author of the post". This seems to work perfectly and will let you know if I need custom coding.

The short code is [types usermeta='user-company-logo' title='%%TITLE%%' alt='%%ALT%%' size='full' user_is_author='true'][/types]

The custom field is "User Company Logo"

I forgot what article I read that showed this unfortunately for anyone that also needs help with this.

Thank you as always for your help!