Saltar al contenido →

Buddypress Xprofile Custom Fields Type

Wordpress Github Donate

This plugin add more fields type to Buddypress extension: Xprofile. The fields type added are:

  • Birthdate
  • Email
  • Web
  • Datepicker
  • Custom post type selector
  • Custom post type multiselector
  • Checkbox acceptance
  • Image
  • File
  • Colorpicker
  • Decimal number
  • Number within min/max values
  • Custom taxonomy selector
  • Custom taxonomy multiselector
  • Range input (slider)
  • Select2 javascript plugin for select boxes.

Buddypress 2.5 must be installed and Xprofile Component must be enabled. Compatible with BP Profile Search plugin.

If you need more fields type, you are free to add them yourself or contact me at [email protected].

FAQ Changelog

  1. Why my fields are not showing?

    If you are using Buddypress 1.7, you need to check if you have the new hook “bp_custom_profile_edit_fields_pre_visibility”. Check in your edit.php (/your-theme/members/single/profile/edit.php, if this page is not in your theme, check in buddypress plugin in bp-themes/bp-default folder) and register page (/your-theme/registration/register.php, if this page is not in your theme, check bp-default theme of buddypress plugin) if this line of code:

    If you don’t see it, you must add it just before the code of visibility settings.

    With Buddypress 2.0, things changed. The new template used by buddypress in edit.php is:

    If your file edit.php don’t have this code, you should not see the fields created with this plugin, so you need to update your template edit.php and also register.php with this code. You only need replace all the content mainly php between this line “<div>” and this line “do_action( ‘bp_custom_profile_edit_fields_pre_visibility’ );”. The old templates should look like this:

  2. Can I change the way in which field values ​​are displayed?

    Yes, you can, since version 1.5.4, I have added a filter called “bxcft_show_field_value”. You can use it and modify the value of your fields. For example, if you need to show only the day or month of the birthdate you need to add this code below in the functions.php of your theme:

  3. How can I put description text below my field’s label?

    For now, you can use javascript to do this. Write this javascript at the end of your template file (register.php for example).

  4. Can I modify the way label and input fields are displayed?

    Yes, you can. Since version 1.5.8, you have new filters to modify the way labels and filters are shown. The filters are:

    • bxcft_field_label: The arguments are: id of field, type of field, name of input, name of field, field is required? (this is a boolean value).
    • bxcft_field_input: The arguments are: id of field, type of field, name of input, field is required? (this is a boolean value).

    For image and file fields, there are another two filters:

    • bxcft_field_actual_image: The arguments are: id of field, type of field, name of input, value of field (url of image).
    • bxcft_field_actual_file: The arguments are: id of field, type of field, name of input, value of field (url of file).
  5. Can I limit numbers of characters allowed in a field?

    Yes, you can do it with this javascript.

    Replace “XXX” with the ID of your field. Replace “YYY” with the number of characters you want. Thanks to wplamp.

  6. Can I change the file and image types that are allowed?

    Yes, you must use the following filters.

    If you want to change the file types allowed, use this filter “bxcft_files_ext_allowed”. In the following code, the file extensions that are allowed are “txt” and “pdf”:

    By default, only “doc”, “docx” and “pdf” are allowed.

    If you want to change the image types allowed, use this filter “bxcft_images_ext_allowed”. In the following code, the image extensions that are allowed are “png” and “gif”:

    By default, only “jpg”, “jpeg”, “gif” and “png” are allowed.

  7. Can I limit file size or image uploaded?

    Yes, you must use the following filters.

    If you want to limit the size of file upload, you have to use the filter “bxcft_files_max_filesize”. The following code shows how to limit the file size to 2MB.

    If you want to limit the size of image upload, you have to use the filter “bxcft_images_max_filesize”. The following code shows how to limit the file size to 10MB.

    By default, the maximum size is set to 8MB for both files and images.

    Remember that if you use these filters, the php.ini variables “upload_max_filesize” and “post_max_size” will always prevail over this filter.