Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing user role in Profile Edit

  • Profile photo of houfton
    Houfton
    Participant

    @houfton

    I am using a clever script to allow users to select a user role on registration:

    add_action('user_register', 'register_role');
    
    function register_role($user_id, $password="", $meta=array()) {
    
    $userdata = array();
    $userdata = $user_id;
    $userdata = $_POST;
    
    //only allow if user role is my_role
    
    if ($userdata == "my_role"){
    wp_update_user($userdata);
    }
    }

    Source: http://www.jasarwebsolutions.com/2010/06/27/how-to-change-a-users-role-on-the-wordpress-registration-form/

    I am trying to adapt it to use on the BuddyPress Profile Edit form but cannot get it to work. I guess it needs the right add_action(). Any ideas what that would be?

Viewing 1 replies (of 1 total)
  • Profile photo of houfton
    Houfton
    Participant

    @houfton

    I think I have answered my own question… the relevant add_action seems to be ‘xprofile_updated_profile’.

Viewing 1 replies (of 1 total)
  • The topic ‘Changing user role in Profile Edit’ is closed to new replies.