donmik
Forum Replies Created
-
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] User Populated Custom TaxonomyThis is not possible right now. I believe I’ve answered this question some time here. The only solution right now is to code it using javascript and a normal text field…
If I have more time I will add it some day but right now I’m out of time. Sorry.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Add image as profile photoHi,
Try this:
add_filter( 'bp_get_displayed_user_avatar', 'my_custom_avatar', 10, 3); function my_custom_avatar($avatar, $r, $args) { // Get the src of the original avatar. $array = array(); preg_match('/src="([^\"]*)"/i', $avatar, $array); if (count($array) > 1) { $old_url_avatar = $array[1]; // Get the new url of image. $uploads = wp_upload_dir(); $new_url_avatar = $uploads['baseurl'] . maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( ID_OF_IMAGE_FIELD, bp_displayed_user_id() ) ); // Replace the old src with the new url. $avatar = str_replace($old_url_avatar, $new_url_avatar, $avatar); } // Return the avatar. return $avatar; }Replace ID_OF_IMAGE_FIELD with the Id of the xprofile image field.
This code uses the “bp_get_displayed_user_avatar” filter to replace the original buddypress-wordpress avatar with an image uploaded using a buddypress xprofile custom field type.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Date Selector to Custom Field (DOB)First, I recommend you make a backup before trying this. If you can test your site locally before it will be better.
Anyway, I’ve tested some use cases similar to what you have.
- If a user has a future birthdate (22 June 2036) when you change to birthdate field, the future birthdate will be the same when displayed but when the user is going to edit the field, the year will be blank because my birthdate field does not have future years. The user will be forced to select a valid year to save the profile form.
- If a user has a valid birthdate (a past date). It will display the date with no errors.
- If you select the option to display the age instead of the birthdate, and the user has a future date, you will see negative ages…
I believe the best way to achieve this, is using the filter “bp_get_displayed_user_mentionname” to modify the user nicename returned. At the end you can add an image or if you want add a span with a custom css class and the background-color.
Something like this should work:
add_filter('bp_get_displayed_user_mentionname', 'my_custom_displayed_user_mentionname'); function my_custom_displayed_user_mentionname($user_nicename) { $checkbox = (int) maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( ID_OF_CHECKBOX_FIELD, bp_displayed_user_id() ) ); if ($checkbox) { $color = xprofile_get_field_data(ID_OF_COLOR_FIELD); if (!empty($color)) { $user_nicename .= '<span class="triangle-class" style="background-color: ' . $color .'"></span>'; } } return $user_nicename; }Replace ID_OF_CHECKBOX_FIELD with the Id of your checkbox acceptance field.
Replace ID_OF_COLOR_FIELD with the Id of your color field.
Replace “triangle-class” with the name of your css class.Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] missing functionsYou’re right, I will do it on next update. Thanks!
Try disabling Autolink feature for your email field.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Extending with PodsI’ve just downloaded and installed Pods plugin. I’ve created a custom taxonomy and associated to posts. I’ve created two new tags and created a new xprofile field using Custom Taxonomy Selector. It’s working well for me.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] missing functionsHi,
Autolink feature was introduced by Buddypress in version 2.5.0. You probably need to update buddypress plugin at least to version 2.5.0 to make it work.
If you don’t want to update, you need to downgrade my plugin to version 2.4.4 and never update.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] missing functionsWhat version of buddypress and my plugin are you using?
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Update version number ??I’ve updated it but WordPress is not updating the version… I will try with the 2.4.8.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Any Plans or Phone Field?Since last version, this filter “bxcft_show_field_value” is deprecated. You need to stop using it because I will remove it on version 3.0.
Use this code instead:
add_filter('bp_get_the_profile_field_value', 'my_custom_field_value', 12, 3); function my_custom_field_value($value, $type, $field_id) { if ($field_id == 241) { $value = sprintf('<a href="tel:%1$s">%1$s</a>', strip_tags($value)); } return $value; }This should work if you have autolink enabled for your field or disabled but I recommend disabling it.
I’ve updated my plugin to version 2.4.7 because while I was looking for a solution about this, I have seen that my plugin was disabling autolink features for the default buddypress field types. This is solved with the latest update.
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Any Plans or Phone Field?What error are you talking about?
Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] Custom Image FieldYou cannot change the parameters of the filter. The following code should work.
add_filter( 'bxcft_upload_dir', 'my_upload_dir', 10, 2); function my_upload_dir($path, $user_id) { return '/registration/' . date('Y/m/d') . '/' . bp_core_get_user_displayname($user_id); }This will save your files inside:
“wp-content/uploads/registration/2016/04/30/USERNAME/”Forum: Plugins
In reply to: [Buddypress Xprofile Custom Fields Type] File upload fieldHere you can read more about permissions with wordpress. 755 is enough probably for uploads folder.
To change the type of files allowed, you need to use: “bxcft_files_ext_allowed”. Read the faq to see how to use it.
Forum: Reviews
In reply to: [Buddypress Xprofile Custom Fields Type] Need source code of v2.3.0https://github.com/donmik/buddypress-xprofile-custom-fields-type/releases/tag/2.3.0
All releases are on github.