Skip to:
Content
Pages
Categories
Search
Top
Bottom

Is it possible in buddypress that user can register with two role ?


  • Hiren Purohit
    Participant

    @crehiren

    Hello,

    I want to add functionality in my site like there are two role for end user {company and employee}.

    Is there any plugin or any custom code available for buddypress registration ?

    Any help would be appreciate 🙂

    Thanks,

Viewing 3 replies - 1 through 3 (of 3 total)

  • Henry Wright
    Moderator

    @henrywright

    Hi @crehiren

    You can do that quite easily. For example, if you wanted to add a new role to the currently logged-in user then you could do this:

    // Get a WP_User object for the current user.
    $user = wp_get_current_user();
    
    // Use the add_role() method to add the editor role to this user.
    $user->add_role( 'editor' );

    Hiren Purohit
    Participant

    @crehiren

    I want this things in registration time. It anyone can check radio on registration time, i want to define that time role for both.

    // Use the add_role() method to add the editor role to this user.
    $user->add_role( ‘editor’ );

    For this method, we can assign role to logged in user, i want it to at register time.

    THanks,


    Hiren Purohit
    Participant

    @crehiren

    Anyone can help me out of this ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is it possible in buddypress that user can register with two role ?’ is closed to new replies.
Skip to toolbar