Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on a site where I'd like anyone to be able to sign up, but people who sign up with an invite code would automatically be promoted to a role with more privileges.

I'm aware that there are plugins that handle invite codes, but so far I haven't found any that will do quite this.

For my purposes, one invite code used by many people would work best. I'd be sending out the invite code to a mailing list, and I'm not that concerned about limiting access.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

This is one way to do it

add_action('user_register', 'set_custom_default_role')
function set_custom_default_role($user_id) {
    // Maybe get available referral codes from database & compare them against the one available
    if(true) {
        $user = new WP_User( $user_id );
        $user->set_role('custom-role-slug');
    }
}
share|improve this answer
    
Thanks, that gives me some ideas. I think in combination with this tutorial (blog.ashfame.com/2010/11/…), I can make it work. –  Adam Rice Oct 20 '12 at 23:14

Try http://wordpress.org/extend/plugins/cm-invitation-codes/ Cm Invitation Code. You can combine it together with Whishlist Member and assign for each new user it's role based on his invitation code

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.