donmik
Forum Replies Created
-
In the latest version 1.5.4, I have created a filter “bxcft_show_field_value”. You can use it to check if the field is empty.
mmm, It’s curious because in one of the latest versions I’ve changed this using the new hook of buddypress 1.7 to show the fields before the privacy options.
Can you show me a link of this?
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] just updated but…If you have a filter or something which apply on birthdate field, maybe you need to delete it because to show the age, you only need to check the checkbox “Check this if you want to show age instead of birthdate:” in the admin.
With the latest version of this plugin and Buddypress 1.7, it’s working. The privacy options are displayed AFTER the field description.
If it’s not working it’s because you are using an older version of buddypress plugin and it doesn’t have the new filter “bp_custom_profile_edit_fields_pre_visibility”.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Some issuesHi,
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!
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Hide year of birthCan you try to do whay I say with var_dump($value)?
In your filter in functions.php, put before:
return '<p>'.date_i18n( 'F j' , strtotime($value) ).'</p>';var_dump($value);I need to know if $value is empty.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Update loopHi,
I’m not using autoupdate but I don’t think it is an error from my plugin. Why do you think it’s from my latest update?
If anyone is having problems with this, please write in this thread.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Playing nicely with other pluginsThank you again!!! You’re right.
I have changed to this hook bp_custom_profile_edit_fields_pre_visibility only if it exists for users who are still using prior versions of Buddypress.
I have also changed to bp_setup_globals. Great debugging!
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Hide year of birthSorry, it’s my fault, I forgot the “;”
var_dump($value);
With the ; it will not show this fatal error.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Playing nicely with other pluginsYou’re right, I have solved this in the latest version 1.5.2.
Thanks to you.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Hide year of birthNo, it’s not a solution, it will show the value contained in the variable $value.
Something like this:
string ‘1908-04-03 00:00:00’ (length=20)
Or maybe something empty.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Multiple/Repeating field groups?Yes, but for now it is not possible to upload multiple files, you need to create one field per file…
The other fields are possible with this plugin.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Is there a height field?I try to create a field for this in the next update when I have a bit more time.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] links turn offYou can use css:
table.profile-fields .data p { font-weight: bold; }I think this should work.
Maybe you can but I don’t know any plugin which can help you now. Sorry!