Reply To: Fatal error: Call to undefined method stdClass::save()
Hi @r-a-y,
Here is the function :
function woffice_birthdays_add_field() {
if ( bp_is_active( 'xprofile' ) ){
global $bp;
global $wpdb;
// We check for multisite :
if (is_multisite() && is_main_site()) {
$table_name = $wpdb->base_prefix .'bp_xprofile_fields';
} else {
$table_name = $wpdb->prefix .'bp_xprofile_fields';
}
$sqlStr = "SELECT <code>id</code> FROM $table_name WHERE <code>name</code> = 'Birthday'";
$field = $wpdb->get_results($sqlStr);
if(count($field) > 0)
{
return;
}
xprofile_insert_field(
array (
'field_group_id' => 1,
'field_id' => 'woffice_birthday',
'can_delete' => true,
'type' => 'datebox',
'description' => __('We will only use it for the Birthday widget, so we can celebrate everyone\s birthday.','woffice'),
'name' => 'Birthday',
'field_order' => 1,
'is_required' => false,
)
);
}
}
add_action('bp_init', 'woffice_birthdays_add_field');
I’m able to reproduce it so I’ll try to troubleshoot it now 😉 I keep you updated,
2F