Re: Profile creation both as individual and organization member
I had to do this recently. Here’s a few hints.
– First, you have to create an interface for changing the usermeta in question. Here’s a simple example, where I added a dropdown to the WP Dashboard Edit User page. the dropdown contains the options “Teacher” and “Student”, and when the profile is saved, the account type is stored in the wp_usermeta table, keyed as ‘acct_type’. (You’ll notice that I’ve only made it available to blog admins – you can change that if you want) http://pastebin.com/n3whEtjd You could just as easily store this information as a piece of BP xprofile data, which has the advantage that you don’t need to worry about the functions for creating the dropdown UI or storing the data on the page. In that case, just add a profile field at Dashboard > BuddyPress > Profile Field Setup
– Then you’ll need a utility function that you can use in your theme templates to check which account type you’re dealing with, and then to display different stuff depending on the account type. Here’s an example from the same project, where I’m checking whether the *logged in* user is a teacher. http://pastebin.com/MqMksYTD If you’re dealing with xprofile data rather than usermeta, you’ll have to use the xprofile tags instead (see especially xprofile_get_field_data() in bp-xprofile/bp-xprofile-templatetags.php). And if you want to check whether the *displayed* user meets a certain criterion (as opposed to the *logged in* user, just call the $bp global (instead of $current_user) and set $user_id = $bp->displayed_user->id (see https://codex.buddypress.org/developer-docs/the-bp-global/ for more details on $bp).
At that point, you can differentiate between the content shown to/about one account type by using conditionals, eg if ( bbg_is_teacher ) { /*blah blah blah*/ } else { /*blah blah blah*/ }
. This can happen mostly at the template level.
Good luck!