Skip Navigation

[Resolved] Use Taxonomy on a per-user bases

This support ticket is created 4 years, 3 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+01:00)

This topic contains 9 replies, has 2 voices.

Last updated by Nigel 4 years, 2 months ago.

Assisted by: Nigel.

Author
Posts
#1474081

Hi

I've created a little site for myself. I can list quiz nights I've run, and then use a taxonomy to assign a venue to that quiz night. It works well.

Issue is I want to create a login for a friend of mind, so he can list his quiz nights.

I am thinking that using a taxonomy for the venue won't let this operate well?

For example, you can list all venues and see how many times you have run events there. If I have two users, I don't think I can just so the post count for the logged in user? I think it will show all the posts?

I also can't have separate venues for different users.

Should I start again and use a custom post for venues? So for example if I run an event at Joe's Pub, I create an entry in the CPT venues and I can then list events. But only I see Joe's Pub as I created it.

Then, if my friend also runs an even at Joe's pub, he could add Joe's Pub as well, and then it would be two separate records, independent of each other.

#1474777

Nigel
Supporter

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

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

Hi David

I'm not sure what you have set up by way of post types in addition to the venue taxonomy.

I don't know that you have to change very much.

You may be able to rely on you and your friend being different post authors of posts.

Any View that you create can include a Query Filter for the post author to only show your results on one page, theirs on another.

You can use a single View and pass which author to filter by as a shortcode attribute where you insert the View (https://toolset.com/documentation/user-guides/views/passing-arguments-to-views/) so that you can re-use the same View.

You are right about taxonomy counts. If you both have had 3 quiz nights at Joe's Pub, then the post count for Joe's Pub will show 6 if you are displaying it.

But you in your Views with an author filter, you can use the shortcode wpv-found-count which will display the count of matching results, and if your View also includes a taxonomy filter then it would show the correct number.

#1474793

Thanks Nigel, I appreciate it.

I'm thinking a better way would have been to make the venues a CPT as well? Would you do that?

The benefit of that is that I could have a list of venues I've added that are just mine, and he can have just his, regardless of it they are the same or different.

I wasn't aware I could filter the post counts though so that's interesting! Thank you!

#1474959

Nigel
Supporter

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

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

Sure, you could create a venue CPT and use a relationship to connect it to your other post type(s). (I'm not sure what they are, but something like an 'event' post type? Whatever you were assigning the taxonomy to.)

It seems a bit redundant creating two "Joe's Pub" posts, but it would certainly achieve the effect of keeping your content separate.

#1475613

I know where your'e coming from Nigel

I think I wanted more of a web app type feel? So something that isn't public, and the records are just for the person logging in. All records completely independent of each other.

Thank of it more like say, Zoho Invoice or Xero or something - online accounting software
If two customers have two accounts and both add a client record of Joe's Pub, they would be completely independent of each other, and if one deleted Joe's pub as a client it wouldn't affect the other person.

#1476647

Nigel
Supporter

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

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

If you used relationships you wouldn't be deleting Joe's Pub, you would be disconnecting from it, while the other user may have posts that remain connected to it.

I feel like I only have half a description of what you are doing, in terms of the types of content and workflows involved, and if you give me a more complete description I could describe how I would go about implementing it.

#1477457

Understood

I want everything separate. So if I make a login for someone, they login and there are no events and no venues. They add their own venues, and then add their own events to their venues. They don't need to see anyone elses venues - it's purely there.

Just like as I mentioned, if you have an an online accounting system. You don't login and see everyone elses customers, you add your own (even if you have the same customer as someone else)

#1482781

Nigel
Supporter

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

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

Screenshot 2020-01-28 at 12.33.20.png
Screenshot 2020-01-28 at 12.30.45.png

Is this all happening in the backend rather than with frontend forms?

In which case it seems like you want to specify a role for users submitting content (different than the admin role you manage the site with), e.g. author.

The defaults for author are that they can publish and edit their own posts, but not those of other users (screenshot, from Toolset > Access Control, if you are using Access).

If outputting lists of events/venues on the front-end, you can include a Query Filter for the post author so that users can only see their own posts (screenshot).

That's the kind of thing you need?

#1482829

Yep, that's what I plan to do

I just need to make the venues a post type instead of taxonomy, so that users can login, add their own venues independent of other users who can login.

#1482883

Nigel
Supporter

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

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

OK, and you know how to do that?

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