Skip Navigation

[Resolved] Displaying information just about the current user

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

Problem:
Client wants to create something like a dashboard page for users where they can see their own content or profile fields of that user.

Solution:
You have a View to show users on that My Account page.

You need to add a Query Filter to specify which user to display. You can't directly add a filter for "current user", you have to do it by specifying that the user ID is set by a shortcode attribute (by default the attribute is called users, but you can change this), see screenshot.

Now go back to where you insert the View and manually add the users attribute, and use a shortcode (which you can insert with the Fields and Views button) to provide the ID of the current user, which results in this:

[wpv-view name="akkaunt-informatsiya-o-vladeltse" users="[wpv-user field='ID']"]

(Note that you need to be careful with the single and double quotes.)

Relevant Documentation:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-user
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-current-user

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

Last updated by Serhii 6 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#1084514

I'm trying to create account page for logged user.

Page: hidden link (you must be logged in to see). That is how she looking now - hidden link

On this page I want to display info just about current logged user. But i dont undestand how to configure view-filter. At this moments displaying information about all user - hidden link (insted about current logged user).

I am using Toolset View on the page hidden link - hidden link

And if I understand correct, I dont know how configure filter of this View - hidden link

Can you help me please?

P.S.: If possible WITHOUT using php, api, hooks, editing functions.php etc.

#1084598

Nigel
Supporter

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

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

Screen Shot 2018-08-16 at 13.37.22.png

Hi there

You have a View to show users on that My Account page.

You need to add a Query Filter to specify which user to display. You can't directly add a filter for "current user", you have to do it by specifying that the user ID is set by a shortcode attribute (by default the attribute is called users, but you can change this), see screenshot.

Now go back to where you insert the View and manually add the users attribute, and use a shortcode (which you can insert with the Fields and Views button) to provide the ID of the current user, which results in this:

[wpv-view name="akkaunt-informatsiya-o-vladeltse" users="[wpv-user field='ID']"]

(Note that you need to be careful with the single and double quotes.)

If you check your My Account page you should find it is now working.

#1084610

Thanks, it's work.

Please share a link where i can read about using [wpv-user field='ID']. Now all work good, but i want to trying understand how it work=)

#1084615

Nigel
Supporter

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

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

Sure, he you can read about the wpv-user shortcode: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-user

And you also have the choice of using the wpv-current-user shortcode:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-current-user

This page describes passing arguments into Views: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

#1084617

Thanks