Support

Home Forums Event Espresso Premium Apply different capabilities to buyers of different tickets to same event?

Apply different capabilities to buyers of different tickets to same event?

Posted: March 29, 2022 at 8:03 am

Viewing 6 reply threads


cctwfest

March 29, 2022 at 8:03 am

I don’t mean when only a user with a specific capapbility can see a specific ticket-type; I know how to do that. I have a single event with three ticket-types, A, B, and C. I want users who buy ticket-type A to be given user capability A post-purchase; those who buy ticket B to have capability B applied, and so forth.

I found a snippet (HERE) that does almost what I want but in that snippet the capability is applied when a person buys any ticket from a specific event. I tried changing EVT_ID to TKT_ID with the correct ticket id number, but that didn’t work. Any guidance you can give me would be greatly appreciated.


Tony

  • Support Staff

March 29, 2022 at 8:29 am

Hi there,

Which snippet are you currently using? I’ll take a look and go from there.


cctwfest

March 29, 2022 at 10:55 am

Sorry – I included it in the question but it didn’t come through:
https://gist.github.com/joshfeck/941ff81380f16e948245f8ef0e6c985b6


Tony

  • Support Staff

March 29, 2022 at 12:04 pm

The above should work if you switch out to use TKT_ID as mentioned above.

Can you post all of the code as you are using it to something like PasteBin and post the link here so I can take a look?


cctwfest

March 29, 2022 at 1:18 pm

Here you go:
https://pastebin.com/ui3FzJV7


Tony

  • Support Staff

March 30, 2022 at 4:39 am

That function works for me.

If I change the TKT_ID to match the ID of the ticket I’m registering onto and then register onto that ticket, I get the ‘foo’ capability added to my account.

I made a couple of changes just to make it a little easier to read and dump th values out so I could confirm it worked but this is what I used:

https://gist.github.com/Pebblo/ccb58ca8b466b7a37bd39184ece1ab55


cctwfest

March 30, 2022 at 7:58 am

Great! Then maybe it’s a plugin conflict or something, but knowing the code should work as I expect is a huge help. Thank you so much. I’ll let you know if I can’t it going.

Viewing 6 reply threads

The support post ‘Apply different capabilities to buyers of different tickets to same event?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso