bp_infusion_soft_sync_bp_data( $user_id )

Sync the BP data based on the WP data via infusion soft API.

Description

Parameters

$user_id

(Required)

Source

File: bp-members/bp-members-functions.php

4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
function bp_infusion_soft_sync_bp_data( $user_id ) {
 
    if ( function_exists('iMember360') ) {
 
        $first_name_id = (int) get_option( 'bp-xprofile-firstname-field-id' );
        $nickname_id   = (int) get_option( 'bp-xprofile-nickname-field-id' );
        $last_name_id  = (int) get_option( 'bp-xprofile-lastname-field-id' );
 
        $xprofile_nick_name  = xprofile_get_field_data( $nickname_id, $user_id );
        $xprofile_first_name = xprofile_get_field_data( $first_name_id, $user_id );
        $xprofile_last_name  = xprofile_get_field_data( $last_name_id, $user_id );
 
        if ( '' === $xprofile_first_name ) {
            $result_first_name = get_user_meta( $user_id, 'first_name', true );
            if ( empty( $result_first_name ) ) {
                $result_first_name = get_user_meta( $user_id, 'nickname', true );
            }
            xprofile_set_field_data( $first_name_id, $user_id, $result_first_name );
        }
 
        if ( '' === trim( $xprofile_nick_name ) ) {
            $user = get_userdata( $user_id );
            // make sure nickname is valid
            $nickname = get_user_meta( $user_id, 'nickname', true );
            $nickname = sanitize_title( $nickname );
            $invalid  = bp_xprofile_validate_nickname_value( '', $nickname_id, $nickname, $user_id );
 
            // or use the user_nicename
            if ( ! $nickname || $invalid ) {
                $nickname = $user->user_nicename;
            }
            xprofile_set_field_data( $nickname_id, $user_id, $nickname );
        }
 
        if ( '' === $xprofile_last_name ) {
            $result_last_name = get_user_meta( $user_id, 'last_name', true );
            xprofile_set_field_data( $last_name_id, $user_id, $result_last_name );
        }
 
    }
 
}

Changelog

Changelog
Version Description
BuddyBoss 1.1.5 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.