Problem with Ultimate member set_role()
-
I am tryng, programmatically, to create users and then change their community roles. The roles have been set once forever at the beginning.
Now the roles that the new users should have are read from a file.
Program is something like that:
……
$user->set_role( ‘editor’, ‘editor’ );
……
$ultimatemember->user->set_role( $title ) ;
……where $title is read from a file. E.g can be “Club Treasurer” (a previously preset role).
If I issue a $ultimatemember->user->get_role() after the set_role( $title ), it is correctly “Club Treasurer”.
From WordPress back-end, I see that the role has been correctly put to <editor>. The ultimatemember role seems set correctly to <Club Treasurer> but there must be a problem because that account does not see all the pages that would his menu would allow. Also, if I manually modify his community role from the backend, the drop down menu shows just the default role, while normally the drop-down menu of roles shows the role currently set.
If I do set the role manually, it seems exactly the same as before but then all works as expected.
any idea ?
thank you
- The topic ‘Problem with Ultimate member set_role()’ is closed to new replies.