Skip Navigation

[Resolved] I need to set the featured post image from the user image automatically

This support ticket is created 5 years, 11 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)

Author
Posts
#1165440

Tell us what you are trying to do? I'm trying to set the featured post image from the user image automatically. In the Create Post Form or in the Edit Post Form I'm thinking that the following hidden code can do that I need. Is it true?

[cred_field field="_featured_image" output="bootstrap" value='[wpv-current-user format="profile_picture"]']

Or if it possible, I need also to change the User Image when the Featured Post Image are changed. This because in my site, every user can create only one post about their profile. The site is a Dating Site service.

I need also to have the Profile Image URL but I don't find the shortcode that permit me to have that...

Is there any documentation that you are following? I have no found a specific guide, but I'm trying to follow this logic: https://toolset.com/forums/topic/add-post-to-a-favorite-list/#post-459894

Is there a similar example that we can see? I don't know

What is the link to your site? hidden link

#1165572

Shane
Supporter

Languages: English (English )

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

Hi Francesco,

Thank you for contacting our support forum.

The best course of action that I would recommend is to remove the profile image option from the user itself and allow it to only be on the Profile CP.

The reason is because custom code will need to be used to keep both image synced. Its also alot easier to keep all the information on the profile CPT rather than the user itself.

However doing it like this [cred_field field="_featured_image" output="bootstrap" value='[wpv-current-user format="profile_picture"]'] should work.

Thanks,
Shane

#1165627

Hi, yes, I think that the good job is to save all into the Profile CPT, and then I prefer to use the Profile CPT Featured image as User Image.
But I need to synced both image, because I'm using also the "Font end PM" plugins to permit the users to comunicate, and the plugin use the user image...

What should I do to synced the User Image from the Profile CPT Featured image?

#1165743

Shane
Supporter

Languages: English (English )

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

Hi Francesco,

How I'm thinking of this being done, is that both the post field and user fields are updated at the same time when the user updates either one.

I mean that if the user updates their profile CPT with a different image, then once the form is saved a cred hook is used to update the user's profile and vice versa.

So it would essentially be updating them anytime something changes.

Thanks,
Shane

#1165769

Hi Shane,
for me it is not simple to create a cred hook to do that.
I have found the cred API here https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data but I don't know what I'm doing, and write, to synch the Profilo CPT featured image to User Image.

#1165783

Shane
Supporter

Languages: English (English )

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

Hi Francesco,

Is the user image field an image created in Types? I mean not the profile CPT image field but the image field that is on the User itself.

If so could you let me know what the slug is?

Thanks,
Shane

#1165793

Hi Shane,
I use the Ultimate Membership Pro to manage the membership, and it have this custom field "ihc_avatar" and I think that it is this. But I don't know why if I want to display the User image It need to use this shortcode [wpv-current-user format="profile_picture"], and than the user image field could be "profile_picture"...?

So, for the Profile CPT I use the default featured image field, and I think that is this "_featured_image".

#1166323

Shane
Supporter

Languages: English (English )

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

Hi Francesco,

I think its best if you allowed me to have access so that I can look around.

The private fields will be enabled for your next response.

Thanks,
Shane

#1167783
gravatar.png

Hi, Shane is out this week and I'm looking over his queue. If I understand correctly, you want to keep two images in sync:
1. The profile picture from the WordPress User profile
2. The Profile post Featured Image
Whenever one is updated, the other should be updated. If I understand correctly, the short answer is it's outside the scope of support we provide here. The WordPress User Profile image is managed by Gravatar, a 3rd party, as you can see in the screenshot "gravatar.png". I don't have any information about how to use their software to update the Gravatar image with an image from the Profile custom post type, nor do I have information about how to listen for changes to the User's Gravatar that must be reflected in the custom field. It will require custom code that is beyond the scope of our support forums to keep these items in sync. We have a contractors portal where you may be able to connect with independent contractors who can help: https://toolset.com/contractors

#1167852

Hi Cristian,
I use the Ultimate Membership Pro to manage the membership, and in its registration module insert a Custom Fields called "ihc_avatar" that is an uploader for user images that assign the image to every users without using Gravatar. But there are also more plugins to manage the User avatar without Gravatar, one of these is this hidden link

So, in the Profile CPT create Form and edit Form I have added the following shortcode in hidden mode

[cred_field field="_featured_image" output="bootstrap" value='[wpv-current-user format="profile_picture"]']

So, with this code the Profile featured image is re-uploaded from the User image, but if a user want to change the Profile image he need to go to edit his User image, and after to go to edit his Profile post and save it. This is not a natural process and more complicated for a simple user.
The simple and logic way is to find a code to sync the two image fields, by uploading the image from the Profile CPT Edit Form.

But now, I see that the WP User Avatar plugin have a shortcode to insert the avatar upload form in every site pages. So, If I insert this shortcode before the hidden shortcode in Profile Edit Form, it can generate some issue? The hidden code take the image immediately a user click on save button of the Profile editor Form?

In the same time, because I think that the Profile post title should be the same of the User login name, in Profile create Form I have inserted in hidden mode this code:

[cred_field field="post_title" class="form-control" output="bootstrap" value='[wpv-user field="user_login"]']

and it work because wordpress don't permit to change the login name after User registration.

Now, I have decided to not using the Ulimate Memberhip Pro Registration Module to manage the user registrations, so I will create the user registrations with Form, and I will use the User Form to manage the billing information.

#1167992

The simple and logic way is to find a code to sync the two image fields, by uploading the image from the Profile CPT Edit Form.
Yes, I can show you how to access any image uploaded from the Toolset Form, but I have no idea how to set it in the WP User Avatar system. If you can show me a code example that modifies the WP User Avatar profile pic with another image URL, I might be able to come up with a good solution.

But now, I see that the WP User Avatar plugin have a shortcode to insert the avatar upload form in every site pages. So, If I insert this shortcode before the hidden shortcode in Profile Edit Form, it can generate some issue?
I don't know anything about their shortcode, but if it produces a form tag it won't work inside a Toolset Form. You cannot insert one form tag inside another form. That's invalid HTML.

#1168006

Hi Cristian,
I need to sync the user image with the Profile CPT post featured image because I use the "Font end PM" plugin to permit the users to send Private Messages, and the plugin use the user images for the messages "chat".

So, if you can help me to modify the filter or the action to display the Profile CPT posts featured image instead of the User image, I don't need to sync the users image with the Profile CPT posts featured image.

#1168670

Hi,
could be a solution that I create the Images CF into User settings and to create a User Form only for media where I can upload the User and gallery images?
And in Profiles list page (Profile Archive, search results, ecc...) instead of use the Profiles featured image, use the Users image?

#1168894

So, if you can help me to modify the filter or the action to display the Profile CPT posts featured image instead of the User image, I don't need to sync the users image with the Profile CPT posts featured image.
If you're using a Tooslet Content Template to display the single Profile CPT posts, then you can simply switch out the image field. If you're not using a Content Template, then I can show you how to access any custom field value. I'm not sure what you mean about modifying the filter or action. Which filter? Which action? How is the image displayed in the single Profile post now?

#1168978

Hi Christian,
so, I decided to use the post author image instead of the post featured image.
Now, in the post, I have changed it, and it is visible the post author image.
After I will "migrate" the gallery custom field from the CPT to User, and I will create new user Form, called add photos, where the user can upload the user image and the photos for the gallery.
I think that solution is the best solution to apply in my case.

What I need to know now is how I can add in menu the link to open the own Profile CPT post for every user that have create a Profile.

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/add-link-to-profile-post-in-menu/