我正在编写一个插件,在激活时添加额外的配置文件组和其中的一些字段。我正在使用basic$wpdb
要在其中插入新行的函数bp_xprofile_groups 和bp_xprofile_fields
所以整个过程看起来很蹩脚:
我将新行添加到bp_xprofile_groups;
我想用BuddyPress挂钩。我找到了我需要的:
xprofile_insert_field_group($args)
和xprofile_insert_field($args)
看起来是这样的:
$args = array(
\'name\' => \'Test\',
\'description\' => \'\',
\'can_delete\' => \'0\'
);
xprofile_insert_field_group( $args );
然后,我假设使用xprofile\\u insert\\u field(),但我不知道刚创建的组的ID,以便在field\\u group\\u ID中使用:$args = array(
\'field_group_id\' => ?????,
\'parent_id\' => \'\',
\'type\' => \'textbox\',
...
...
);
xprofile_insert_field( $args );
有人有什么建议吗?