Skip Navigation

[Resolved] "Assign" post to another user behind related post

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 11 replies, has 2 voices.

Last updated by katjaL 11 months, 1 week ago.

Assisted by: Minesh.

Author
Posts
#2673451

In my site, there are 3 level users (visitors, handlers, checkers) and all operate in frontend.
Visitors (Subscriber-role) can leave "Note" custom post.

Checker (Editor-role) checks the note and assigns a handler for the note. The assigning is done via related custom post "Handler". After assigning the Handler post is parent to the Note. And the Handler CP's author is a user with Author-role.

My goal is to show the visitor and the post's handler the visitor's post. Also they both should be allowed to make child custom posts, "handling", to the parent "note".

So I have 3 custom posts:
- Notes
- Handlers
- Handlings

And 2 relations
- Note -> Handlings (one to many)
- Handler -> Notes (one to many)

My problem concerns the view for the handlers: how do I show the Notes that the logged in user's own Handler-posts are assigned to? I have tried filter "Select items in any relationship as related items of the current post in the loop". Tried other settings also, not working.

#2673485

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL and tell me on what section of that page/post you want to display what content.

*** 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.

#2673827

Minesh
Supporter

Languages: English (English )

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

Can you please send me frontend user access details as well for the user "kasittelija".

As I understand on the following page: hidden link

You have added the three views but out of that two view shows correct results and one view does not. Can you please share URL of the view that is not working as expected or not showing the result as expected as well.

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

#2673835

Thank you Minesh, yes the same page has all the 3 views and one of them, kasittelija's, doesn't work. The kasittelija user's password (as the "arvioija" useri's also) is "testisalasana". Login at vihella.fi/wp-admin and go to page hidden link

#2673839

Minesh
Supporter

Languages: English (English )

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

You said:
There is this one note/ilmoitus ("katja testaa ilmoitusta") which has the hander set "Käsittelijä 1".

So when the author of Käsittelijä 1 (that is user "kasittelija") is logged in, she/he should see this one post "katja testaa ilmoitusta".

===>
So, I need login details of user "kasittelija". is "kasittelija" is a role or user name? And what view you are using and do I need to visit the same page you shared when I login as user "kasittelija"?

#2673855

kasittelija is username, kasittelija's role is Author as described in first post. There are three views in the page mentioned, when you log in as kasittelija/testisalasana, go to page hidden link. You'll see the view's resulting "No items found" there (should be one item). And the view is called in backend "Ilmotuksen seuranta kasittelijat"- Unfortunately I can't find the view's id. ANyway, it's the middle view of the three views and wrapped with [toolset_access role="Author" operator="allow"]

#2674325

Minesh
Supporter

Languages: English (English )

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

On this page - as you can see:
- hidden link

I try to fetch first posts whose author is current loggedin user "kasittelija". So it displays the two posts as both post's author is "kasittelija":
- hidden link

Is this correct result? if your need is to display both the posts then we can display the related post title with link of the post type "ilmoitus".

#2674345

No, I need to show posts "ilmoitus" which are related to the current logged in kasittelija user. This is because we can't have 2 owners for the post ilmoitus. If we could, I would attach the author and a kasittelija user. But because there can't be 2 owners/authors for a post, I try to show the post through relation.

So this kasittelija user owns/is author of a kasittelija custom post which is related to the ilmoitus posts. And I need to show the related ilmoitus posts.

#2674673

Minesh
Supporter

Languages: English (English )

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

Can you please change the author for one of the post on the following page? is this possible or all posts will have the "kasittelija" author assigned?
- hidden link

What we can do is first we have to find all the "kasittelija" posts whose author is current loggedin user in this case its "kasittelija" and based on the posts return for loggedin user we will find the related "ilmoitus" posts. Does that sounds good?

#2674707

IMHO this is excactly what I tried to do in my view block, if I now understand you right. ANyway now one of the kasittelija post's (Käsittelijä 1) author is kasittelija.

#2674757

Minesh
Supporter

Languages: English (English )

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

Can you please check now:
- hidden link

Under the "From Toolset" label I've added the following view:
- hidden link
The above view is used to fetch the post whose author is current loggedin user.

Then within the view's loop I've used another nested view: [wpv-view name="show-related-ilmoitus-posts"]
- hidden link

This view is used to fetch the related posts attached to found loggedin user author posts.

Can you please confirm it works as expected.

Please note that we have to use classic view as block view do not support nested view (view inside view).

#2674859

Hi Minesh, now it is just what I need. Thank you very much! I didn't actually realize you could use classic views beside blocks, that's great!

(It would be very nice if you would hide the links, thank you very much.)