Skip to:
Content
Pages
Categories
Search
Top
Bottom

Different User Profiles

  • Avatar of Tiptap
    tiptap
    Participant

    @tiptap

    Hi guys.

    I want to user a different user profile template depending on the user type.

    Now the user type currently doesnt exist – so i need to set this up as a custom field first.

    User types would be [General User | Business]

    Then I need some sort of if statement to put in profile>index.php (im guessing thats where i put it) which loads another file depending on the user type

    Any help / pointers appreciated

Viewing 12 replies - 1 through 12 (of 12 total)
  • Avatar of Roy McKenzie
    Roy McKenzie
    Participant

    @roymckenzie

    This sort of functionality would be great! Is their a way to do this with user roles in wordpress?

    Avatar of Tiptap
    tiptap
    Participant

    @tiptap

    Well I thought if I add a custom profile filed. Make it a drop down.

    Then all i need to do is check the value of that field on profile/index.php

    The profile field is fine. However, how do i then call its value in an if statement?

    Avatar of gerikg
    gerikg
    Participant

    @gerikg

    I don’t know how it can be done but I know it can be done with this:

    http://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-profile-data-loop-bp_has_profile/

    Avatar of Tiptap
    tiptap
    Participant

    @tiptap

    I think I’ve solved it (but havent built it yet). This is what I’m going to do;

    -Write a function in bp-custom.php

    - Function takes the current ID and passes that to the db returning the usertype (which is a custom profile field)

    - Run the function on profile/index.php

    - then do a simple switch statement to show the appropriate template

    Avatar of Tiptap
    tiptap
    Participant

    @tiptap

    Ok so I created;

    /wp-content/plugins/bp-custom.php with the below in it;

    /**
    * bp_check_usertype()
    * TEMPLATE TAG
    *
    */

    function bp_check_usertype($userID) {

    global $bp, $wpdb;

    $qry = $wpdb->get_var("SELECT value FROM wp_bp_xprofile_data WHERE field_id = 5 AND user_id = " . $userID);

    /* Sort the nav by key as the array has been put together in different locations */
    echo $qry;

    }

    However when I call it in /bp-themes/mymember/profile/index.php like so;

    $bp->bp_check_usertype($bp->displayed_user->id);

    I get the following error

    Fatal error: Call to undefined function: bp_check_usertype() in /html/wp-content/bp-themes/mymember/profile/index.php on line 31

    Am I missing something?

    Avatar of Tiptap
    tiptap
    Participant

    @tiptap

    works a charm

    Avatar of gerikg
    gerikg
    Participant

    @gerikg

    what was missing?

    Avatar of Tiptap
    tiptap
    Participant

    @tiptap

    I called the function incorrectly

    $bp->bp_check_usertype($bp->displayed_user->id);

    should have be

    bp_check_usertype($bp->displayed_user->id);

    Avatar of noizeburger
    noizeburger
    Participant

    @noizeburger

    This is a good start. As I’m not too deep into Buddypress yet, I need some more help:

    1. which file should I use as a basic user-template?

    2. where do i have to put in what (the function)?

    I’ve already put a file called bp-custom.php in my wp-content/plugins directory with the above function in it (I’m using wpmu 2.8.5.2 and bp 1.1.2).

    Now in which template-file do I have to put the call bp_check_usertype($bp->displayed_user->id); ?

    This is one of the last features I would need to put my site online.

    Thank you for helping me!

    Avatar of Mezloh
    Mezloh
    Participant

    @sayno2odor

    Any way this could be wrapped into a plugin?

    Avatar of noizeburger
    noizeburger
    Participant

    @noizeburger

    No one out there who can help?

    Avatar of infocoolsms
    infocoolsms
    Participant

    @infocoolsms

    this plugin provide this features

    http://wpbpshop.com/buddypress-user-account-type-pro

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

You must be logged in to reply to this topic.