Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change profile groups by dropdown custom field chosen at registration.

  • Avatar of couchdavid
    couchdavid
    Participant

    @couchdavid

    Hello there,

    Thank you for such a wonderful contribution and such a supportive and informative community. This is the first time I’ve actually needed to use the forum to ask a question myself, haha.

    Anyway, I am hung up on one thing. Seems so simple, but I can’t figure out what I’m doing wrong.

    Upon registration, my new user will select a menu option from a dropdown menu generated with a custom profile field from built-in X-profile. I have done this.

    Based on the selection made from this dropdown menu, I would like to display a particular profile group for the user to edit, and only load that particular profile group for that user. This is where I’m hung up.

    It is simple to hardcode one visible profile in for the edit page. But to do it dynamically, based on the selection made is really tripping me up.

    As an example:
    People that choose “producer” from the dropdown menu at registration would only see “profile_group_id=2″ when they edit their profiles, which has relevant fields for them that are irrelevant to other users.

    People that choose “musician” would only see “profile_group_id=3″ on the edit profile page. Does that make sense.

    I fear that I’m just making it too complicated at this point. I’ve tried several approaches, this is my latest:

    `

    `

    I’ve coded myself into oblivion at this point. And the above is a hail mary based on some stuff I’ve seen on these very awesome forums, but I’m not sure if I even know what kind of hooks I need to be getting here. Ugh.

    I sincerely appreciate any guidance.

    cheers!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Avatar of couchdavid
    couchdavid
    Participant

    @couchdavid

    `

    `
    Trying the code embed again…

    Avatar of couchdavid
    couchdavid
    Participant

    @couchdavid

    Avatar of couchdavid
    couchdavid
    Participant

    @couchdavid

    I’m sure I need to change something in this line from the edit.php to get the desired effect:

    http://pastebin.com/tqWJcbj7

    But I can’t quite figure out what “bp_get_current_profile_group_id” function is *doing* in the xprofile template file. Or what I could do to it to make it behave the way I want it to without ruining its current function…

    Any help is greatly appreciated as always.

    Avatar of couchdavid
    couchdavid
    Participant

    @couchdavid

    Putting my IF statement into a function called “position_type”, I thought this could work, but still no dice:

    if ( bp_has_profile( ‘profile_group_id=’ . bp_get_current_profile_group_id(position_type) ) ) :
    while ( bp_profile_groups() ) : bp_the_profile_group();

    Thanks again, everyone.

    Avatar of couchdavid
    couchdavid
    Participant

    @couchdavid

    Okay, I feel like this one should work, but it’s showing not really making anything happen…

    in my bp-custom file (lifted heavily from John James Jacoby’s informative post here: http://buddypress.org/support/topic/calling-specific-profile-fields-individually/#post-55905):

    http://pastebin.com/UQNYWcax

    In my edit.php file, I replaced “bp_get_current_profile_group_id()” with the custom_position function

    Thanks again!

    Avatar of couchdavid
    couchdavid
    Participant

    @couchdavid

    I have also tried leaving the first lines in “edit.php” alone and adding to the bp_get_current_profile_group_id() function. I’m not nearly as smart as I thought I was. Ha!

    function bp_current_profile_group_id() {
    echo bp_get_current_profile_group_id();
    }
    function bp_get_current_profile_group_id() {

    if ( !$profile_group_id = bp_action_variable( 1 ) )
    $profile_group_id = 1;{
    elseif (custom_position (‘Actor’));
    echo ‘Actor’;
    $profile_group_id = 2;{
    elseif ();
    }
    }

    return apply_filters( ‘bp_get_current_profile_group_id’, $profile_group_id ); // admin/profile/edit/[group-id]
    }

    Avatar of couchdavid
    couchdavid
    Participant

    @couchdavid

    Still no luck. It’s a real head scratcher as I can’t decipher what some of these hooks mean…

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

You must be logged in to reply to this topic.