Skip to main content
added example
Source Link
GhostToast
  • 4.6k
  • 3
  • 28
  • 44

Not sure how you want to handle groups, but it could just be user_meta.

Regardless, you could use Gravity Forms + user registration add-on to process a user registration and determine what group the user should be added to. This should work even if you are using third-party hooks.

If it's simple user_meta, you can just check for that wherever you want to limit membership, and avoid stacking up tons of third party plugins.

Here is an example.

// assign group based on code input
add_action('gform_after_submission', 'the_grouper', 10, 2);
function the_grouper($entry, $form){
    $current_user = wp_get_current_user();
    $current_user_id = $current_user->ID;
    
    switch $entry['group_code'] {
        case 'CODE_123' :
            $group = 'group_123';
            break;
        
        case 'CODE_ABC' :
            $group = 'group_abc';
            break;
        // etc
        
        default:
            $group = false;
            break;
    }
    
    if($group){
        update_metadata('user', $current_user_id, 'the_group', $group);
    }
}

Not sure how you want to handle groups, but it could just be user_meta.

Regardless, you could use Gravity Forms + user registration add-on to process a user registration and determine what group the user should be added to. This should work even if you are using third-party hooks.

If it's simple user_meta, you can just check for that wherever you want to limit membership, and avoid stacking up tons of third party plugins.

Not sure how you want to handle groups, but it could just be user_meta.

Regardless, you could use Gravity Forms + user registration add-on to process a user registration and determine what group the user should be added to. This should work even if you are using third-party hooks.

If it's simple user_meta, you can just check for that wherever you want to limit membership, and avoid stacking up tons of third party plugins.

Here is an example.

// assign group based on code input
add_action('gform_after_submission', 'the_grouper', 10, 2);
function the_grouper($entry, $form){
    $current_user = wp_get_current_user();
    $current_user_id = $current_user->ID;
    
    switch $entry['group_code'] {
        case 'CODE_123' :
            $group = 'group_123';
            break;
        
        case 'CODE_ABC' :
            $group = 'group_abc';
            break;
        // etc
        
        default:
            $group = false;
            break;
    }
    
    if($group){
        update_metadata('user', $current_user_id, 'the_group', $group);
    }
}
Source Link
GhostToast
  • 4.6k
  • 3
  • 28
  • 44

Not sure how you want to handle groups, but it could just be user_meta.

Regardless, you could use Gravity Forms + user registration add-on to process a user registration and determine what group the user should be added to. This should work even if you are using third-party hooks.

If it's simple user_meta, you can just check for that wherever you want to limit membership, and avoid stacking up tons of third party plugins.