For reference, here is an example of the settings currently set via globals and constants:
global $pmproio_invite_required_levels;
$pmproio_invite_required_levels = array(18,19);
global $pmproio_invite_given_levels;
$pmproio_invite_given_levels = array(17); //defaults to $pmproio_invite_required_levels
define('PMPROIO_CODES', 10); //defaults to 1
define('PMPROIO_CODES_USES', 1); //defaults to unlimited
Instead of adding a Memberships -> Invite Only settings page or adding settings to the advanced settings page, I think we should add these all to the edit level page.
So on the edit level page, it would have a settings section:
Invite Only Settings
[ ] Require an invite code to checkout for this level.
[ ] Give members of this level invite codes.
How many times can codes be used: [ ] Leave blank for unlimited. (shows up if the give codes checkbox is checked)
How many: [ ] (shows up if the how many times setting is > 0)
We would be going from global setting (which makes sense in a lot of ways based on the current design of having codes that work across levels/etc) to settings per level. We don't need to at this time go completely down the rabbit hole of supporting different sets of codes for different levels. However, we should allow different levels to give different numbers of codes.
We should default to the global var settings if level specific settings haven't been set. So users who upgrade wouldn't even have to change the settings. When you view a level that hasn't had the invite only settings changed/set, you would set the options set based on the global settings.
To allow for this programatically. We should add wrappers to getting the settings. So a function like pmproio_getSettings($level_id) that would get settings for a specific level id. If there are no settings saved in options (or level meta) we would check the global vars, then return the settings.
Let me know if this makes sense. I'm open to discussion.