Thanks both for the feedback!… looking into xprofile_insert_field() in bp-xprofile/bp-xprofile-functions.php. This appears to be the function for adding a new profile field to the BP system.
`function xprofile_insert_field( $args = ” ) {
global $bp;
extract( $args );
/**
* Possible parameters (pass as assoc array):
* ‘field_id’
* ‘field_group_id’
* ‘parent_id’
* ‘type’
* ‘name’
* ‘description’
* ‘is_required’
* ‘can_delete’
* ‘field_order’
* ‘order_by’
* ‘is_default_option’
* ‘option_order’
*/
// Check we have the minimum details
if ( !$field_group_id )
return false;
// Check this is a valid field type
if ( !in_array( $type, (array) $bp->profile->field_types ) )
return false;
// Instantiate a new field object
if ( $field_id )
$field = new BP_XProfile_Field( $field_id );
else
$field = new BP_XProfile_Field;
$field->group_id = $field_group_id;
if ( !empty( $parent_id ) )
$field->parent_id = $parent_id;
if ( !empty( $type ) )
$field->type = $type;
if ( !empty( $name ) )
$field->name = $name;
if ( !empty( $description ) )
$field->description = $description;
if ( !empty( $is_required ) )
$field->is_required = $is_required;
if ( !empty( $can_delete ) )
$field->can_delete = $can_delete;
if ( !empty( $field_order ) )
$field->field_order = $field_order;
if ( !empty( $order_by ) )
$field->order_by = $order_by;
if ( !empty( $is_default_option ) )
$field->is_default_option = $is_default_option;
if ( !empty( $option_order ) )
$field->option_order = $option_order;
return $field->save();
}
`
All I really need to do is add a little record into the existing “wp_bp_xprofile_data” table
This below code works however it’s definately not Open source friendly or BP friendly
`
// grab this users nicename
$user = get_userdata( $iallusersUserID );
$nicename = $user->user_nicename;
$last_udpated = date(‘Y-m-d H:i:s’);
// create a new record in bp_xprofile_data and add the nicename
$wpdb->insert(
‘wp_bp_xprofile_data’,
array(
‘field_id’ => 1,
‘user_id’ => $iallusersUserID,
‘value’ => $nicename,
‘last_updated’ => $last_udpated
),
array(
‘%d’,
‘%d’,
‘%s’,
‘%s’
)
);
`
Any thoughts? Thanks again!