Skip Navigation

[Gelöst] How to display a single WP user profile from a linke directory of user profiles?

This support ticket is created vor 4 Jahre, 1 Monat. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 6 Antworten, has 2 Stimmen.

Last updated by jeffS-2 vor 4 Jahre, 1 Monat.

Assisted by: Nigel.

Author
Artikel
#1517661
Directory View.png
Member Profile Full view.png

Tell us what you are trying to do?
I have a brand new directory site in which I created a directory page, listing WP user profiles. It displays only a few fields from each profile (name, email, phone.) A link at the bottom of each displayed profile in the directory listing should open and display the full profile (based on a content_template single.) But, I can't figure out how to make that link work so it displays the profile using the content_template single. It opens the template, but always displays the WP profile data from the current user, not from the user select from the Directory page.

What I currently have:
Page: "Patel Directory" - calls [wpv-view name="Member Profile Directory"]
View: "Member Profile Directory" - User view, any role, order by register date, no filter, no pagination, calls [wpv-post-body view_template="Member Profile Short"]
Template: "Member Profile Short" - Displays WP User profile fields, a few extended Types User fields, and includes a "View Profile" link at the bottom that links to the page, "Member Profile" to display that selected view as a single view with more information (more user fields.)

Page: "Member Profile" - calls [wpv-view name="Member Profile Full"]
View: "Member Profile Full" - User view, any role, order by register date, limit 1 item, no pagination, filter = Select users with the id determined by the URL parameter "users-filter" and with role "(any)" eg. yoursite/page-with-this-view/?users-filter=1
Template: "Member Profile single" - Displays a more full profile including WP User profile fields plus more extended Types User fields.

Is there a similar example that we can see?
Sort of. I have done this for a different site, but it uses a CPT for profiles, not the WP user_profile, so I use [wpv-post-url] but of course that won't work for a User. - See the working CPT site here:
hidden link

What is the link to your site?
Site is currently at: hidden link

Jeff
–––––

#1518475

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

Hi Jeff

I'm not sure what the problem is here.

If you have a User View when you insert fields you have the user selection option where you can specify if it should be the user from the View loop or the currently logged-in user, and it defaults to the user from the loop which is what you need.

In my simple test site for a user View I output the display name and a custom user field, and the source in each case is the current user from the loop.

[wpv-user field="display_name"]
[types usermeta="capacity"][/types]

Maybe the Query Filter you are using isn't working correctly, it has the ID of the logged-in user instead of the intended user?

#1519017

Hi Nigel, and thanks for the reply.

The funny thing is, the URL looks correct, such as: If I click the "View profile" link in one of the short profiles displayed on the Directory (listing) page, the URL looks like: hidden link
So, the member-profile is the correct page, and the users-filter=2 is the second small profile displayed on the directory page, BUT the data is coming from the current logged-in user every time ("Boss Man" instead of "Mickey Mouse".) I am getting data, but they are from the wrong user. Note that the user_ids are 1,2,3,4,5.

Please let me know if you now understand the problem.

Thanks,
Jeff Safire
–––––––––––

#1519055

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

Yes, but is your Query Filter correctly listening to the right parameter?

Try turning on the Views debugging to see details of the resulting query (at Toolset > Settings > Front-end Content).

Try outputting the parameter in your View using the wpv-search-term shortcode (https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-search-term).

#1519663

Nigel -

I got it to work. I had the views set up properly. The problem was in the Page: Somehow the Content Template on the page was selected as "Member Profile Full". But, there should not be a content template set for this page since I am relying on the View to handle that. I set the content template to "None" and everything works as expected.

I guess the setting of that content template is conflicting with the calling of the Views shortcode?

Anyhow, it's resolved.
Thanks for the help.

Jeff
–––––––

#1520447

Nigel
Supporter

Languages: Englisch (English ) Spanisch (Español )

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

What's in the Member Profile Full template?

If you have a template assigned to the page then the page content (where you inserted the View) wouldn't be output at all, unless the Member Profile Full template included the post body, so maybe it was outputting a similar-but-different View?

In any case, glad you spotted the problem.

#1521655

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.