I should have read your post more carefully before answering.
The choices for ticket availability right now are for “Everyone”, “Logged in Users”, or “Guests”. If you choose “Logged in Users” you can restrict it to specific roles. I suggest you assign a role to your members (say the role is called “member”) then you could restrict the tickets just to users with the “member” role.
You can use the Members plugin to create the new “member” role.
To maintain the “member” role correctly you could use the following code snippet:
add_action('pmpro_after_change_membership_level', function($level_id, $user_id, $old_level) {
if ($user_id == 0)
return;
$user = get_userdata($user_id);
if ($level_id && $level_id > 0 && (empty($old_level || $old_level == 0))) {
$user->add_role('member');
}
else if (!empty($old_level) && $old_level > 0) {
$user->remove_role('member');
}
}, 10, 3);
To add the code snippet you can use the “Code Snippets” plugin.
To assign the “member” role to all your current members you could use the following code snippet (set this to run only once in the Code Snippets plugin).
$users = get_users();
foreach ($users as $user) {
$level = pmpro_getMembershipLevelForUser($user->ID);
if ($level !== null && $level > 0) {
$user->add_role('member');
}
}
-
This reply was modified 11 months, 3 weeks ago by
joneiseman.