Alright, here’s where I am at. However, it seems to be riddled with errors. Anybody see anything glaringly wrong with my plugin? I’m getting parsing errors around line 7
1,
‘type’ => ‘selectbox’,
‘name’ => ‘Featured Teacher’,
‘description’ => ‘Showcase your teacher on your Profile’,
‘is_required’ => false,
‘can_delete’ => true,
‘order_by’ => ‘name’
);
$featured_teacher_list_id = xprofile_insert_field($teacher_list_args);
if ($featured_teacher_list_id) {
$featured_teachers = array(
while ( bp_members() ) : bp_the_member();
$fitlinkzmembertype = xprofile_get_field_data(‘Member Type’, bp_get_member_user_id());
if ($fitlinkzmembertype == ‘Teacher’) :
bp_member_name();
endif;
endwhile;
);
foreach ($featured_teachers as $i =>$featured_teacher) {
xprofile_insert_field(array(
‘field_group_id’ => 1,
‘parent_id’ => $featured_teacher_list_id,
‘type’ => ‘selectbox’, // it is ‘selectbox’ not ‘option’
‘name’ =>$featured_teacher,
‘option_order’ => $i+1
));
}
}
}
//Featured Group
add_action(‘bp_member_meta_init’, ‘featured_group_list’); // That might not be the perfect hook to use
function featured_group_list() {
if (xprofile_get_field_id_from_name(‘Featured Group’)) return;
$group_list_args = array(
‘field_group_id’ => 1,
‘type’ => ‘selectbox’,
‘name’ => ‘Featured Group’,
‘description’ => ‘Showcase your group on your Profile’,
‘is_required’ => false,
‘can_delete’ => true,
‘order_by’ => ‘name’
);
$featured_group_list_id = xprofile_insert_field($group_list_args);
if ($featured_group_list_id) {
$featured_groups = array(
while ( bp_groups() ) : bp_the_group(); if(custom_field(‘fitlinkz-group-type’) == ‘Group’ ) :
bp_group_name();
endif;
endwhile;
);
foreach ($featured_groups as $i =>$featured_group) {
xprofile_insert_field(array(
‘field_group_id’ => 1,
‘parent_id’ => $featured_group_list_id,
‘type’ => ‘selectbox’, // it is ‘selectbox’ not ‘option’
‘name’ =>$featured_group,
‘option_order’ => $i+1
));
}
}
}
?>