guess you confuse member types and user roles. MT where introduced to allow site owners to “categorize” their users. WP user role is slightly different, as it defines what user can do on a site, a kind of access management. So in brief, roles are independent from BP member types.
MT and roles are also stored in different tables: MT in wp_terms and roles in wp_usermeta – with the denomination of wp_capabilities…
By default, roles are automatically attibuted at registration level or manually by a site admin. Member types follow the same logic, under condition the xprofile component is activate.
Now the question is: what do you want to do exactly after registration ? Change the role or change the type ?
Roles can be affected from the admin user list page. I would recommand to not modify this behave at registration level, to avoid abuse by promoting fake user for example.
MT can be changed from the xprofile admin interface. There is also this plugin for a more in depth management.
Using a custom function is of course possible. But just to clarify, the one you give as example let’s suppose you have a need for bulk action over user status. Automated task is well and good, but in this case, why not attribute a higher role or type to all by default ?
And if it is not intended for “all” (what i suppose is the case), do you have so many exception that you need such a function ? Can’t you do that manually ? Just my 2 cents. 😉
Thanks for the explanation and insight danbp! I am not married to updating the user role with a function. The only reason I wanted to do it is because I’m using the events manager plugin and I don’t want basic members to have permissions that are determined using the role. And I’m open to other options….
If i update the role with a function, I can avoid hiding a bunch of things using functions…which is easy enough….but my thinking was that updating the role was more efficient.
I do want to do this automatically, because I want to grant users privileges during registration.
Which do think is a better option: hiding a bunch of screen elements with a function based on the member_type attribute I created; or, updating the role at registration and have these element hidden automatically using the Events Manager plugin?
Many thanks again!
been thinking more about it, and I really hope to update the user role with a custom function. I can’t figure out why the code above won’t do this? Any suggestions you have are greatly appreciated!