Tell us what you are trying to do?
I have CPT Specialist which is created by a user (public profile sort of), then I have another CPT called Courses,
which are courses we provide at our rehabilitation center, not online.
Then I created many-to-many relationship between Specialist and Courses, to see which courses have the specialist completed.
Finally, I have an intermediary post related to Specialists-Courses relationship called Certificates holding custom fields like name of the Course completed, Date the certificate was issued and so on.
I created a view of that intermediary post (please see IMG screen2) shown in the post created by a user (Specialist profile).
I also have a page supposed to be kind of a dashboard for the user when they logged in (please see IMG screen1) and on the "Kurzy SPS" tab I want to view the same information as on IMG screen2 = view of the relationship related to the CPT created by the user.
But after hours of trying I am still not able to figure out how to set the view... could you please help me with this?
Is there any documentation that you are following?
I have read all related documentation
Is there a similar example that we can see?
Please see IMG screen4 where is set up for the view I have already set up properly - shown in the post created by the user.
The View works correctly in the context where it is inserted in the template for single Specialist posts, correct?
But not when you add it to a page (the dashboard page).
The problem is with the filter in that case, it doesn't know which specialist is the starting point to look for related posts.
On the dashboard page how do you know which specialist it is?
Because the solution is likely to involve changing the Query Filter so that you are filtering for posts related to a post which you specify with a shortcode attribute: see my screenshot.
So where I insert my View I can pass the ID of the post which represents the starting point with the wpvrelatedto attribute, e.g.
That would work where you insert the View into the template for single Specialist posts, because the wpv-post-id shortcode is going to return the id of the current post, i.e. the currently displayed specialist.
So that would get you back to where you are now, but allow you to insert the same View somewhere else (your dashboard page), but it requires a different means of providing the id of the specialist post.
Again, on the dashboard page, how do we know the ID of the specialist post?
I am sorry, but not sure if I understand your answer...
Yes, I have views on that user dashboard working correctly, but the query is set to "Select posts with the author the same as the current logged in user" - can't do this since the user is not the author of either Course or Intermediary post (certificate)?
and on the specialist page (not dashboard) is the query filter set to "Select posts in an SPS-M_specialista relationship that are related to the Post where this View is shown." - can't do this since the view is not shown in a post?
Again, on the dashboard page, how do we know the ID of the specialist post?
The currently logged-in user is author of the post = specialista (post, which I need the ID from) in the SPS-M_specialista relationship
(...and in that view I am showing both Title of SPS-M post and Intermediary custom field = certificate date)
On your dashboard page you want a View to query certificates related to... nothing available directly, the current page doesn't help you.
So instead, create an outer View to return the specialist post authored by the current user, then in the output section of that View you insert a View like your existing View but where the Query Filter is to show certificates related to the current post in the loop, which will be the specialist of the parent View.