Skip to:
Content
Pages
Categories
Search
Top
Bottom

Profile creation both as individual and organization member

Viewing 2 replies - 1 through 2 (of 2 total)

  • Boone Gorges
    Keymaster

    @boonebgorges

    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!


    meetvora2006
    Participant

    @meetvora2006

    i exactly want same as @renegaebd described in this article. i want individual can register him self as organisation as well it show in all organisation page in my website. any kind of help??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Profile creation both as individual and organization member’ is closed to new replies.
Skip to toolbar