Skip Navigation

[Resolved] Cannot display current user photo from custom field with Views

This support ticket is created 4 years, 10 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
- 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 7 replies, has 2 voices.

Last updated by alinaB 4 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#1455099

I have a page where I display an overview of the custom user fields that were filled by the user at the registration.

For the image field, for example, I have defined a View where Content Selection is Users -> Any role. First of all, in the Query filter, I cannot select the current user, so I leave it empty.

The loop looks like this:

 
<wpv-loop>
		[wpv-post-body view_template="loop-item-in-user-profile-photo"]
	</wpv-loop>

The Template for this View looks like this:

[types usermeta='user-photo' size='full' current_user='true'][/types]

And the Output Editor:

 
[wpv-filter-meta-html]
[wpv-layout-meta-html]

However, on the given page where I insert this View, what I get is ALL the images uploaded by users, not the one corresponding to the currently logged in user.

Not the same thing happens when I use a built-in WordPress field, like 'description' or "first_name", where I have the [wpv-user ...] shortcodes.

What am I doing wrong?

#1455843

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

As I understand, with the view you created, you want to display only current logged-in user information - is that correct?

#1455883

Hello, Minesh.

Yes, that is correct. I want to be able to accomplish what is accomplished with the shortcode [wpv-user field="profile_picture"], but instead of that built-in field I want to use a custom field.

#1455897

Minesh
Supporter

Languages: English (English )

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

To display custom user field you can use the Types shortcode and you can also use the shortcode you shared that is[wpv-user field="profile_picture"]

Is it possible for you to send me admin access details and problem URL where you want to display the user fields and what user fields you would like to display? If no:
- Can you send m screenshot of your edit view?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) 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.

#1455927

Minesh
Supporter

Languages: English (English )

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

Sorry, the description you shared with point #1 is different from the issue reported to display the user custom field.

Can we take the issue step by step one at a time. So, let's talk again for issue #1.
1. the problem with profile_picture is that I cannot set users to upload it by CRED -- or is it possible? I've done that for other custom fields, e.g. transfer the value of the field to other field with cred_save_data. Is 'profile_picture' a valid meta key for an already existing field? The WordPress Codex does not mention it, as far as I know. If this is possible, problem solved on this page I was discussing before, I guess (I will need to test).
==>
Where did you add the Toolset form? Can you please share the link where I can see the form?

Regarding updating the default Profile Picture - there is no field available to add the picture to the default Profile Picture field. I would recommend you to go with the custom image field only. Do you have any issues uploading the image to the custom image field?

#1456001

There is no issue to upload the image to the custom field with the cred form. The issue is that I cannot display, on the page mentioned in my previous message, the image associated with the current logged-in user only -- it displays the custom images with the same slug from all selected user roles (images are identical, since I am in the testing phase).

#1456009

Minesh
Supporter

Languages: English (English )

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

Ok - So, I see you are using the Oxygen builder to build your page and I've added the shortcode wrapper and to the shortcode wrapper I've added the following shortcode to display the image:

[types usermeta='user-photo' title='%%TITLE%%' alt='%%ALT%%' size='full' current_user='true'][/types]

Can you confirm it works as expected?

#1456021

I confirm that it works very well. Thank you very much!