Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'profile fields'

Viewing 25 results - 5,176 through 5,200 (of 5,701 total)
  • Author
    Search Results
  • #55130
    jazgold
    Participant

    just buy a bag of buns

    there are quite a few wordpress plugins for extending user profiles…

    i once used cimy extra user fields for a project, and it worked fine for my purposes. it looks like there are a bunch of options nowadays.

    #7266
    buzz2050
    Participant

    Hi,

    This is my first time with BP and my very first post in the BP forums. I have a query related to the members-loop.

    We have grouped our bp members role-wise. They choose a role from a set of four predefined roles while signing up (it’s a custom profile field).

    I have provided 4 tabs for 4 roles on my members page and clicking on a particular tab should only show the members belonging to THAT role. How can this elegantly be achieved with BP 1.1? Is there any template tag available?

    I basically want to collect the members-array that is returned by bp_site_members() and further filter it by ‘role’.

    I suppose I can hack the core, or maybe add my own function in bp-custom.php file to retrieve the members by whatever clause I want or maybe there is already a way in BP of doing this that I’m just not aware of.

    Not sure, if this is much simpler in logic than in my head right now.

    Any help much appreciated

    Thanks,

    Sib

    #7214
    grosbouff
    Participant

    Here’s a piece of code I wrote to sync the

    -name (core field)

    -last name (custom field)

    -first name (custom field)

    from BP with WPMU :

    -BP name becomes WPMU display name

    -BP first name becomes WPMU first name

    -BP last name becomes WPMU last name

    You have to create those 2 fields in the xprofile admin; then set their ids in the functions

    $first_name_field_id=…;

    $name_field_id=…;

    They have to be set in the BASE group of xprofile (group id #1).

    function sync_wp_bp_names() {

    global $bp;

    if (bp_get_current_profile_group_id()!=1) return false;

    require_once( ABSPATH . WPINC . ‘/registration.php’);

    $user = new WP_User($bp->displayed_user->id);

    $first_name_field_id=40;

    $name_field_id=39;

    //DISPLAY NAME == BP NAME

    if ( isset( $_POST[‘field_1’] ))

    $user->display_name = esc_html( trim( $_POST[‘field_1’] ));

    //FIRST NAME

    if ( isset( $_POST[‘field_’.$first_name_field_id] ))

    $user->first_name = esc_html( trim( $_POST[‘field_’.$first_name_field_id] ));

    //LAST NAME

    if ( isset( $_POST[‘field_’.$name_field_id] ))

    $user->last_name = esc_html( trim( $_POST[‘field_’.$name_field_id] ));

    wp_update_user( get_object_vars( $user ) );

    }

    add_action( ‘xprofile_updated_profile’, ‘sync_wp_bp_names’ );

    What do you think of that ?

    I also don’t understand the differences between display name and nicename in WPMU…

    #54933
    grosbouff
    Participant

    Here’s a piece of code to replace the displayed nickname by name+firstname.

    change $first_name_field_id and $name_field_id to match your fields.

    /**

    NAME + FIRSTNAME | START

    */

    function user_name_firstname($fullname,$user_id=false) {

    global $bp;

    global $site_members_template;

    $first_name_field_id=40;

    $name_field_id=39;

    if ( !$user_id ) $user_id=bp_get_the_site_member_user_id();

    if ( function_exists(‘xprofile_install’) ) {

    $first_name= xprofile_get_field_data($first_name_field_id, $user_id );

    $name = xprofile_get_field_data($name_field_id, $user_id );

    if ($name) {

    $fullname = $name;

    if ($first_name) $fullname.=‘ ‘.$first_name;

    }

    wp_cache_set( ‘bp_user_fullname_’ . $user_id, $fullname, ‘bp’ );

    }

    return apply_filters( ‘user_name_firstname’, $fullname );

    }

    add_filter( ‘bp_get_the_site_member_name’, ‘user_name_firstname’,9);

    /**

    NAME + FIRSTNAME | END

    */

    Now I have to find a way to order the directory member results by Name+Firstname… Any idea ?

    #54788
    jantanner
    Participant

    Thanks for the quick help. It works fine with me.

    Any quick idea, how to link it to the members search like usual profile fields do?

    greetings from berlin

    Christoph

    #54743

    In reply to: Profile Field Linking

    Paul Wong-Gibbs
    Keymaster

    It might be a better idea to use the xprofile data template loop https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-profile-data-loop-bp_has_profile/ and put some IFs in so it only uses the fields you want to see?

    #7148
    wordpressfan
    Participant

    In the default profile-loop, field data is linked so that you can click on “Chicago” and every member that lists “Chicago” as her location will be listed. However, linking is gone when I use the following to extract data from specific fields:

    echo xprofile_field_data('field#');

    How do I retain the normal field data linking?

    #54734
    wordpressfan
    Participant

    The next step would be to add some code checking first to see whether there is any data for that field. If true, print the data, if not echo ‘(no data found)’.

    #54733
    wordpressfan
    Participant

    @smuda: yes.

    @poolie: thanks! that works.

    #54699
    Paul Wong-Gibbs
    Keymaster
    #54682
    poolie
    Participant

    <?php echo xprofile_get_field_data('2'); ?>

    would work, where 2 is the id of the field.

    #54681
    smuda
    Participant

    @wordpressfan did you wrap <? ?> around it? :)

    @andy that still doesn’t seem to work. <?php echo xprofile_get_field_data($2); ?> gives an error. <?php echo xprofile_get_field_data($name); ?> too. :/

    #54678
    wordpressfan
    Participant

    How do I echo the field’s data?

    The line “echo xprofile_get_field_data( $field_name_or_id [, optional $user_id] );” only displays “echo xprofile_get_field_data( $field_name_or_id [, optional $user_id] );”

    #7140
    wordpressfan
    Participant

    I want to display the data of individual profile fields, rather than printing them all at one time. For instance, I have a “location” field in the base profile area.

    #7075
    mr_adamson
    Participant

    Hello.

    In the wp-admin under “buddyPress” and “Profile Field Setup” i have created two custom fields “Location” and “Favorite Grape”,

    When i user resgisters these fields are shown on the registration page but the data isn’t saved.

    But when the user edits the profile the two boxes appear (but blank) and if the data is entered then it is saved.

    I have noticed that the table “wp_bp_xprofile_data” isn’t storing these details until they edit their profile.

    Does anyone know what i need to do to make it work.

    Thank you

    #54356
    shedmore
    Participant

    Anybody have ideas on the post/question above????

    fubp
    Participant

    *Bump.

    Please anyone?

    fubp
    Participant

    When a user registers and adds the custom profile date information, they cannot be seen on the profile. However if you go into edit profile mode later, and enter the information, it then becomes viewable.

    wp_bp_xprofile_data table does not get filled with the custom profile data. However once user edits the profile, that data is then entered.

    Is this a bug? I am using 1.1.1 of BP and wordpress 2.8.4a

    fubp
    Participant

    I checked the database and all I saw was some arrays in the wp_signups meta info.

    Any clean method of getting that info out ?

    #7018
    danielfelice
    Participant

    Hi Everyone,

    I think this question was asked a while back but I cannot find it in the forums.

    I am wondering how to remove the auto linking in the profile info fields on the member page. I want to remove the link for the members name and replace it with the link the user enters for the URL.

    So the members name in the profile info area links to they specify when signing up.

    Thanks

    Dan

    #7008

    Below is an example of how to add a simple text field to a new users usermeta when they register…

    In a new plugin file, your functions.php, or bp-custom.php put…

    /* Add sign-up field to BuddyPress sign-up array */
    function bp_custom_user_signup_field( $usermeta ) {
    $usermeta['field_name'] = $_POST['name_of_field_in_template'];

    return $usermeta;
    }
    add_filter( 'bp_signup_usermeta', 'bp_custom_user_signup_field' );

    /* Add field_name from sign-up to usermeta on activation */
    function bp_user_activate_field( $signup ) {

    update_usermeta( $signup['user_id'], 'field_name', $signup['meta']['name_of_field_in_template'] );

    return $signup;
    }
    add_filter( 'bp_core_activate_account', 'bp_user_activate_field' );

    Then somewhere in your custom register.php file, put…

    <input type="input" name="name_of_field_in_template" id="name_of_field_in_template" value="" />

    Replace “name_of_field_in_template” and “field_name” with what you need, and rename the functions if you want to, etc… Now when people sign up on your website, you can have custom usermeta that gets entered when they activate their account!

    If you wanted to pump this up a notch, it’s possible to create a function to retain the value and send/receive field formatting errors also, so you can expand this to do something like youtube or twitter id’s on sign-up, outside of tying the fields into xprofile. Obvious uses for this would be to integrate BP with existing plugins that use usermeta already, letting your sign-up process get the headstart on setting up user accounts with the information those plugins want/need.

    Have fun! Happy hacking!

    I might make an example plugin for people to tear apart later if there’s interest.

    #54176
    shedmore
    Participant

    Okay…I have more details from my testing. It works now, but I am not really sure WHY. It seems to me that you have to (for some reason) call the get_field_data function (even if its on a useless peice of data) before you can use the set_field_data function.

    If you notice from my post above…the only thing that is different is that I have added a new variable that is simply capturing the Name field (number 1). Well when I add this:

    $nametestfield = xprofile_get_field_data(1,$wpuid);

    And then the set_field after it (with my age variable)…than it starts working, and the field is inputted.

    SO….Is there a reason why you can’t call the set_field independently. Calling in the name is basicaly useless in the function above, but it DOES make the whole thing work for some reason.

    ///////////////////////////////

    function BP_Insert_Test($wpuid, $age) {

    $age = ‘tester gender’;

    $nametestfield = xprofile_get_field_data(1,$wpuid);

    echo(‘user name exists already’ . $wpuid . ‘ and userdata is ‘ . $age);

    echo(‘Need Field is’ . $nametestfield);

    xprofile_set_field_data(2, $wpuid, $age);

    }

    #54174
    shedmore
    Participant

    For some reason…no matter what I try, I can’t inject SPECIFIC variables via the xprofile_set_field_data function….I run this function (below)

    ONLY AFTER running two conditionals to make sure

    /////////

    ONE the buddypress globals are set

    and

    TWO the check for the xprofile function passes

    Both conditionals pass (as expected) then go to my test function below

    ////////

    End result — The echo statement appears correctly…but nothing is appearing in the field values for the user – I am pulling my hair out??????

    Sample

    ////////

    function BP_Insert_Test($wpuid, $age) {

    $age = ’22’; // Should appear in the profile

    echo(‘user id is ‘ . $wpuid . ‘ and userdata is ‘ . $age);

    xprofile_set_field_data(2, $wpuid, $age);

    }

    Any ideas?

    #54166
    Damon Cook
    Participant

    I’m attempting to do something kinda similar. I just want to create a block (pardon my Drupal lingo) that shows a blog’s author information in my theme. I want to specifically show their BP custom fields.

    Right now I’ve copied over bp-sn-parent/profile/profile-loop.php to my theme and called: locate_template( array( 'profile/profile-loop.php' ), true ) but this gives me everything in the user’s profile. I would like to get a little more granular and just specify certain fields. hmmm

    Here is my current example as it exists.

    #54157
    shedmore
    Participant

    Okay….Andy is probably busy, I didnt mean to explicitly ask Andy (only) :)…if anyone has any advice on this I would appreciate it!

Viewing 25 results - 5,176 through 5,200 (of 5,701 total)
Skip to toolbar