Skip Navigation

[Resolved] Need to show posts from users which match with field from page

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

Problem:
Need to show posts from users which match with field from page

Solution:
To match custom post field with custom user field, you should filter your view using view's shortcode attribute.

You can find the proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/need-to-show-posts-from-users-which-match-with-field-from-page/#post-1110425

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

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

Last updated by MennoB5853 6 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#1109484

Hi Toolset,

Thanks for this great plugin.

I would like to show posts and users from a custom post type 'bikes' from users with a custom field 'province' on a page with a custom field 'state'. So showing which have a match with a custom field of a page.

I'm creating a page of all states in my provinces of my country and i would like to show them all users in that province and a listing of bikes which can be bought in that province.

Thank you 🙂
- Menno

#1110185

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - I need to first understand your structure. Do you have built any post relationship between your post types?

- Do you want to compare the loggedin user custom field with which post type field?

#1110364

Hi Minesh,

Thanks for your response. I have the default post type Pages and a custom post type Bikes.

I have a custom field 'State' in the Post type Pages and also a user custom field 'State'. Both have the same values, like 'Groningen'.

Now i have a Page with page title Groningen with custom field 'State' and value 'Groningen'. I would like to have a view on this page with all users with the custom user field 'State' with value 'Groningen'. Is this possible?

Thanks. Menno

#1110425

Minesh
Supporter

Languages: English (English )

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

What if you try the following:

1) Create a User view and format "Loop Editor" as per your requirement
2) Add Query Filter for your custom USER field "State" and set it to filter by Shortcode attribute and use value "pagestate" in the input box and save the query filter
3) Go to your page, add this user view with shortcode attribute, For example:

[wpv-view name="your-user-view-slug" pagestate="[types field='state'][/types]"]

Where:
- Replace the respective attribute values as required

Dose this help?

#1113057
Schermafbeelding 2018-09-21 om 16.52.23.png

I tried this but it's not working yet.

I have a user field with the slug 'provincie' and a page custom field called 'provincie' too. I added value 'Utrecht' to both user and page.

And added a user view with shortcode attribute 'provincie' (see attachment).

And added this shortcode:
[wpv-view name="generator-verkopers" provincie="[types field='Provincie'][/types]"] to the page.

Already tried testing with capital letters, but still not working.

#1114208

Minesh
Supporter

Languages: English (English )

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

Well - could you please share problem URL where you added your view and access details so I can check what's going wrong there.

*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.