Skip Navigation

[Resolved] Using image uploaded on user registration form in custom type content template

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 8 replies, has 3 voices.

Last updated by JacquesF783 6 months, 3 weeks ago.

Assisted by: Waqar.

Author
Posts
#2694970

Hello,

I would like the user to be able to upload an image (profile picture) on the user registration form.
Then In the custom type content template I would like this image to be displayed if the user that creates the custom post wants to.

How can I achieve this?

Thanks,

Regards,

Jacques

#2695042

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Jacques

You have created a profile image custom user field, which is included in your registration form, yes?

When you say "the custom type content template", do you mean that you have created a custom post type for displaying user profiles? Which is linked to the user through the post author field of the post type displayed with the content template?

(See this page for more on that: https://toolset.com/course-lesson/how-to-create-custom-searches-and-relationships-for-users/)

In which case I would expect the profile image to be a field belonging to the profile post, rather than to the user.

That would be straight forward to output in the template, but I guess you need another field (e.g. a checkbox) where the user specifies whether the profile image should be public or not.

In which case you could wrap the output of the image in a Conditional block, that tests this "public" checkbox.

See this page for details: https://toolset.com/course-lesson/using-toolset-conditional-block/

Let us know if you need more help. I haven't gone into too many details, because I'm not sure if I've understood your question correctly.

#2695051

Hi Nigel,

No it's not a custom field. (If I understand correctly)
When a user registers:
he will have to fill the below fields

Email
Username
Password
Memorial Owner
First name
Last name
profile pic (image upload)

All of these are standard wordpress user fields as you know, besides the image upload

Now when the user creates a new custom post, In my case memorial.
I want to give him the option for his profile pic uploaded at registration - to be dispalyed somewhere I will choose on the content template.
So basically I need it to be a dynamic field I can access it from the content template.

Hope I explained myself well.

Thanks,

Best Regards,

Jacques

#2695098

Hi Jacques,

I'll assume that the 'profile pic (image upload)' field that you mentioned is a user custom field, that was added through Toolset Types.

If that is correct, you can use the Types Fields API shortcode in your template, to show that image from this user custom field, uploaded by the currently logged-in user:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image

Example:


[types usermeta='profile-pic' title='%%TITLE%%' alt='%%ALT%%' size='medium' resize='proportional' current_user='true'][/types]

Note: You'll replace 'profile-pic' with the actual slug of your user custom field.

regards,
Waqar

#2695115

Hi Again,

I will try to explain myself better.

A logged of user can register here: hidden link
At the bottom of the form there is a generic field where he can upload a profile picture.

After registration and log in hew can create a memorial here : hidden link
Then I would like to give him the option to add his profile pic to the memorial he creates. Even though he uploaded the image while being logged off at registration.

Here you can see an example of a memorial: hidden link

Thanks a lot,

Jacques

#2695211

Basically what I want to do is to let the user upload a profile picture at registration and give him the option to add his profile pucture in the posts he creates.

Thanks,

Jacques

#2695220

Thank you for sharing these details.

> A logged of user can register here: hidden link
> At the bottom of the form there is a generic field where he can upload a profile picture.

- I see that this 'create account' page is using a Toolset User form. Instead of a generic field, you can register an image type user field for the profile picture, as shown in this screencast:
hidden link

When you include this user field in this registration form a profile picture will be saved with the user's information.

> After registration and log in hew can create a memorial here : hidden link
> Then I would like to give him the option to add his profile pic to the memorial he creates. Even though he uploaded the image while being logged off at registration.

- Yes, for the custom fields for the memorial post type, you can include a new select type field 'Shop Profile Picture' with two options 'Yes' and 'No'.

In the post form on the 'create-pet-tribute' page, you'll include this 'yes/no' field, to record the user's choice.

And in the template for the single memorial page, you can include a conditional block that shows the profile picture through its shortcode below, only if the value of the 'yes/no' field is 'yes'.

Example of the shortcode to show the user profile picture from user field:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image


[types usermeta='profile-pic' title='%%TITLE%%' alt='%%ALT%%' size='full' user_is_author='true'][/types]

#2695243

Hi Waqar,

Thanks, but I still have a problem

So I created the field group : User Info
I added new field : image with slug :user-profile-picture
I was able to find it in the custom fields in the edit user form and it displays fine.
Then in an individual memorial I want to display it (first without condition just to see it works)

I added [types usermeta='user-profile-pic' title='%%TITLE%%' alt='%%ALT%%' size='full' user_is_author='true'][/types]

But in the front end in doesnt show anything.

Please advise?

Thanks

#2695250

Hi,

I succeeded by adding a fields and text block.
There I could choose the image from user info

Thanks a lot,

Jacques