I am having difficulty setting a user role when creating a user. It fails saying it's the incorrect format. I've tried arrays, strings, integers and nested arrays.

Comments

Neograph734’s picture

Does this only occur on user creation, or also on updating existing users? If it is only on creation I have no idea, otherwise you might try to set an array of roles keyed by role id. Like this:

array(
  [3] = 'role3', // use systemname here
  [7] = 'role7',
);

That should work.

nicxvan’s picture

I haven't tested on update. I ended up creating a rule that assigned the role.