Hi,
I have just updated my plugin to add a new filter. Now you can use this filter to change the way it shows the field value. The filter name is bxcft_show_field_value. So to customize, birthdate, website or custom post type do it adding this filter in your functions.php:
add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4);
function my_show_field($value, $type, $id, $value_to_return) {
if ($type == 'birthdate') {
$value = str_replace("<p>", "", $value);
$value = str_replace("</p>", "", $value);
$field = new BP_XProfile_Field($id);
// Get children.
$childs = $field->get_children();
$show_age = false;
if (isset($childs) && $childs && count($childs) > 0) {
// Get the name of custom post type.
if ($childs[0]->name == 'show_age')
$show_age = true;
}
if ($show_age) {
return '<p>'.floor((time() - strtotime($value))/31556926).'</p>';
}
return '<p>'.date_i18n( 'F j' , strtotime($value) ).'</p>';
} elseif ($type == 'web') {
if (strpos($value, 'href=') === false) {
$value = str_replace("<p>", "", $value);
$value = str_replace("</p>", "", $value);
return '<p><a href="'.$value.'" target="_blank">'.$value.'</a></p>';
} else {
$value = str_replace('href=', 'target="_blank" href=', $value);
return $value;
}
} elseif ($type == 'select_custom_post_type') {
$value = str_replace("<p>", "", $value);
$value = str_replace("</p>", "", $value);
// Get children.
$field = new BP_XProfile_Field($id);
$childs = $field->get_children();
if (isset($childs) && count($childs) > 0) {
// Get the name of custom post type.
$custom_post_type = $childs[0]->name;
}
$post = get_post($value);
if ($post->post_type == $custom_post_type) {
return '<p><a href="'. get_permalink($post->ID).'">'.$post->post_title.'</a></p>';
} else {
// Custom post type is not the same.
return '<p>--</p>';
}
}
return $value_to_return;
}
The first if is the same if for birthdate, it must show the birthdate without year. If it does not work, try to var_dump($value); and we will see what value is contained. If it is empty there is a problem when saving birthdate.
The second if is for website. I’ve added a target=”_blank”.
The third id is for custom post type. I’ve added a link to permalink of post.
All this code answer to 1, 3 and 5.
2. Can I see a picture of what are you saying about privacy options or maybe you can send me a link to see for myself.
4. No, you cannot deactivate plugin, the fields won’t disappear but the users can still see them when they edit their profile and while this plugin is deactivated, they will show the fields as textboxes. So you can have some errors.
No problem!