Posted: December 7, 2018 at 1:23 pm
We have built upon a solution EE has provided for dealing with ticket selector(s) still available after a successful registration but are still having one issue:
I needed to hide the “Member” ticket row/selector upon registration. Using the code from https://gist.github.com/Pebblo/10669adfeea322ade3d96a38857fb46b I can display a message as required (Thank you for that) and can successfully remove the row BUT it removes the same Member ticket row from other events that the user has not yet registered for. I don’t want to use the Capability method as it doesn’t account for cancelled registrations. Ideally I would like to specify the ticket for the event (it only specifies a registration I think) and only for a specific event. Can you guide me please? Thank you.
|
|
One option would be to set a custom, one-time use capability (which can work with cancellations). You’ll find example code here: https://gist.github.com/joshfeck/51c2ef122616b48cc4846b1f44384859 Another option would be to put together a custom script like this other user did: https://eventespresso.com/topic/unique-emails-upon-registration/ |
|
Those options won’t work for us. There is a series of four events per year, same basic tickets, Member and Guest. I have been trying https://gist.github.com/Pebblo/10669adfeea322ade3d96a38857fb46b and it works to display the message but it displays on all events whether a ticket has been registered or not. In a perfect world I would be able to target a ticket with a specific name and at a specific event. |
|
These 2 lines of code:
would normally make it so the message displays only on events where the logged in user has already registered, and not displayed on other events where they have not already registered. I don’t have any guesses for why that message is appearing on all of your events. One possible troubleshooting step you could do would be to add:
and, while logged into the site, check and make sure the Post ID printed on the screen matches the ID of the event. |
|
It seems the issue is with Trashed registrations, they still viewed as registrations.
Is there any way to be more specific regarding the status of a registration? And can I target a specific ticket name “Member” leaving Guest option still available? Thank you.
|
|
Hi there,
Yes, there is, but you can’t use the method currently in use to do it. Replace: With this:
That will not pull in registrations that have been trashed.
Yes, but you’ll need to use a completely different function and do it a little differently. I’m assuming your ‘member’ ticket has a capability set on it? |
|
Great, thanks for the Trash solution.
Yes, but all events with have this specific Member ticket and have the same capability. |
|
So depending on what you want to do, you can use something like this: https://gist.github.com/Pebblo/eabb317ca126f5b298eca78755f2cbd1 That function works differently from the above in that it filters each row of the ticket selector, so the above pulls the capability set on the ticket (to make sure it only works on tickets with a cap set) and if one is set it will check if the current user’s contact has a registration for that ticket. If it does it completely removes that ticket from the ticket selector, otherwise, it will show as normal. There’s various different ways to handle that situation, for example you could output a message on the ticket selector similar to how the WP User integration add-on does now but the above should help get your started. |
|
The support post ‘Hiding ticket selector after registration’ 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.