I am writing a plugin that adds additional profile group and some fields in it when activated. I am using basic
$wpdb functions to insert new rows into bp_xprofile_groups and bp_xprofile_fields
So the whole process looks very lame:
- I add new row to bp_xprofile_groups;
- I get ID of that row (WHERE name = 'New Group Name');
- I use these ID to insert new rows to bp_xprofile_fields
Some fields are options so in total I make 5 SQL queries just to create 1 group field and 4 option fields with 2 checkboxes in that field group.
I would like to make it using BuddyPress hooks. I found what I need:
so it looks like this:
$args = array( 'name' => 'Test', 'description' => '', 'can_delete' => '0' ); xprofile_insert_field_group( $args );
and then I am suppose to use xprofile_insert_field() but I do not know ID of a group I just created to use in field_group_id:
$args = array( 'field_group_id' => ?????, 'parent_id' => '', 'type' => 'textbox', ... ... ); xprofile_insert_field( $args );
Does anyone have any suggestions?