Skip to:
Content
Pages
Categories
Search
Top
Bottom

The add_action equivalent off WP edit_user_profile for BP

  • Avatar of mediabros
    mediabros
    Participant

    @mediabros

    I have a function that add some custom profile fields in to the user profile in the backend wp-admin/profile.php. This is WordPress only so do not get confused.

    here you can find the function

    http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields

    There are four actions added.

    add_action( ‘show_user_profile’, ‘user_show_define_category’ );
    add_action( ‘edit_user_profile’, ‘user_show_define_category’ );
    add_action( ‘personal_options_update’, ‘user_save_define_category’ );
    add_action( ‘edit_user_profile_update’, ‘user_save_define_category’ );

    The function will add a input field into the backend user profile of WP. /wp-admin/profile.php

    What i am looking for are the equivalents of the WP show_user_profile, edit_user_profile, personal_options_update and edit_user_profile_update for Buddypress.

    So that the input field will show up on the frontend profile in g.e. /members/username/profile and /members/username/profile/edit/group/1

    so

    instead off

    add_action( ‘show_user_profile’, ‘user_show_define_category’ );

    something like

    add_action( ‘show_buddypress_user_profile’, ‘user_show_define_category’ );

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    Open buddypress/bp-themes/bp-default/members/single. Individual member profiles are created with profile.php and profile/profile-loop.php. There are do_action definitions throughout those templates. Try hooking your function to anyone of them.

    Avatar of mediabros
    mediabros
    Participant

    @mediabros

    Hi Boone,

    Thanks for the reply, i got a bit further by changing

    add_action( ’show_user_profile’, ‘user_show_define_category’ );
    add_action( ‘edit_user_profile’, ‘user_show_define_category’ );

    into

    add_action( ‘bp_after_profile_loop_content’, ‘user_show_define_category’ );
    add_action( ‘bp_after_profile_field_content’, ‘user_show_define_category’ );

    Now it shows up well on the user frontend profile.

    I can’t seem to find the correct way for updating

    Do you have a clue what hook to use for personal_options_update and edit_user_profile_update?

    add_action( ‘personal_options_update’, ‘user_save_define_category’ );
    add_action( ‘edit_user_profile_update’, ‘user_save_define_category’ );

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    It’s going to be more complicated to save items into wp_usermeta (which is I assume what you’re doing, given the link) with update_user_meta() from the BP profile page. You’ll have to hook a function to somewhere in the BP loading process that will catch the value of $_POST and manipulate the data manually.

    Can I ask what might be a silly question? Why don’t you just use BP profile fields? Dashboard > BuddyPress > Profile Field Setup. That’ll add new fields to the profile that can be displayed and updated natively through BuddyPress.

    Avatar of mediabros
    mediabros
    Participant

    @mediabros

    Thanks i will look in to it more next day, the reason why i won’t use the plugin.

    I want to give users the possibility to link themselves to a category.

    Lets say i am building a marketplace.

    I want the people that sell cosmetic products to be link to the category: cosmetics.

    I thought to do it one step at the time and first to figure out how to save and display data from a input field.

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    Yeah, it’s not all that easy to populate an xprofile dropdown dynamically. I can think of a few ways to do it, but it might be complex.

    Here’s the general direction I’d move: http://pastebin.com/DM8YNzsq Obviously your $_POST array key will be something else, and you may want to do some data checking before saving. But that’s the skeleton of what you need.

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

You must be logged in to reply to this topic.