There's a nice bit of code for limiting appointments within a time span.
But my use case is that I have memberships which are a certain number of appointments per membership cycle, like 5 in 30 days, or 10 in 90 days, etc.
Just checking the days is not quite sufficient, because the visits counter resets after every membership cycle (payment).
Is there some function/hook/filter for finding the last payment date by the member? If so, could I see how that would change the code sample referred to above?
Actually, I see that the wp_m_member_payments table has both level_id and member_id.
Oh, and assume a table called packages which has fields package_id/membership_level_id, service_id, and limit. I think that should work.
Also, later, since members can have multiple memberships which cover different services, I will need to write a function to return the memberships/packages that include those services, so that I can check for the right payment.