user_can()
will be a useful function. It accepts a WP_User
object or user ID and a role name.
Ref: https://codex.wordpress.org/Function_Reference/user_can
With user_can()
I can check for user capabilities but what BuddyPress template files or hooks I have to use to edit the user profile page? (I’m talking about the ‘website.tld/users/NAME_OF_THE_USER/profile/’ page)
All of the core BuddyPress navigation functions are in bp-core/bp-core-buddybar.php. You can see the contents of that file here:
https://github.com/buddypress/BuddyPress/blob/master/src/bp-core/bp-core-buddybar.php
I think he is referring to roles based on member_type, not by wp capability (role).
As he mentioned above, his buddypress website having various roles, so he wants to display different profile field based on created role.
If role is a (member_type) lyricist = profile field
If role is a (member_type) singer = profile field
Yes, it’s like @youmin is saying.
If role equal A show in profile B and C
If role equal X show in profile Y and Z.