Posted: October 26, 2020 at 1:09 am
|
Our pottery classes have limited numbers. Each term, some students re-enrol and some may leave. We, therefore, want to have a set number of tickets available for returning students and make the remaining tickets available for new students. For example, the course may have 10 places and we have 6 returning students and therefore have four places for new students. How do we achieve this so that four tickets are available for new students, but that there are six tickets available for the returning students? I have set up the class dates and created two tickets, one with 4 places for the new enrollments and another for six places that are limited by the “Subscriber” role. The two tickets display, but there is no selector for the Subscribers to actually purchase the tickets. The interface just says “On Sale” against the “subscriber” ticket. How can I achieve a situation where returning students can actually purchase one of the six tickets allocated to returning students? Peter |
Hi Peter, Adding a minimum capability on the ticket itself basically means users are forced to log into the site to register onto that ticket. Using ‘Subscriber’ simply means they need to be a subscriber on the site (which any registered user will be by default) rather than having a previous registration. If logged in users that are indeed Subscribers still can’t see that ticket then there’s a few things to check, first… If you have ‘Subscriber’ set in that field you need to change it to be ‘subscriber’ (yes, the capitalized S mattered here as there is no Just to clarify, the ‘Minimum required capability’ field you are referring to doesn’t restrict based on role, but rather capability. It uses the WP core function current_use_can() to check the capabilities on the current user, note this text on the page for that function:
Checking for a specific role can be a little strange as it’s not really the ‘correct’ way to do it. So, if you use ‘subscriber’ as the capability and then check the ticket selector whilst logged in as a subscriber, does it allow you to register onto that ticket? |
|
|
Hi Tony, I had copied the “Subscriber” role text from the users’ table and pasted it into the Ticket Capability Requirement field, thinking that would involve the least chance of errors – but in this case, this seems to have caused the error. If the Ticket Capability Requirement requires a lower case input, could the system do a case conversion when retrieving the value? Just a thought. Thanks for your solution to my issue though – it is much appreciated. Peter |
Yeah, so you are checking for a ‘role’, which is technically the wrong way to do it. Roles are simply collections of capabilities and it is the capabilities that give you access to various settings/pages/anything. To give an example, if I gave you an account on my site and set it as an Administrator role but then removed all of the capabilities on your account that and admin would have and left you with only the caps a subscriber would have and your an Admin or Subscriber? The short answer is your a Subscriber with a name tag/badge that says your an Admin. Anywhere that still gives you access to sections only an admin would have is doing_it_wrong() (yes, event WP core if it does it).
No, because the Ticket Capability Requirement field does not require anything other than a valid capability (or more specifically, anything that current_user_can() considers valid). On the Subscriber role, there is no The confusion here is based on the fact that at some point it was considered a good idea to allow the functions used to check what a user can do to also base those checks on the role rather than capabilities. It’s bad practice as individual users can have specific capabilities and using roles to check for those limits what you can do. It’s now discouraged but the fact that checking for the role ‘Subscriber’ may seem valid throws a spanner into the works without knowing the background. |
|
The support post ‘A mix of returning students and new students’ 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.