Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing user role in Profile Edit

  • Avatar 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)
  • Avatar 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)

You must be logged in to reply to this topic.