Add new field type: decimal number with two digits of precision #20

Closed
wants to merge 5 commits into
from

Conversation

2 participants
@ftena

ftena commented Jun 16, 2015

By default, the field of type 'Number' in BuddyPress doesn't allow decimal numbers.

I've coded a new class (see classes/Bxcft_Field_Type_DecimalNumber.php) to add a new field type which supports numbers with two digits of precision.

@ftena

This comment has been minimized.

Show comment
Hide comment
@ftena

ftena Jun 23, 2015

I've updated the main php file to solve a problem with translations.

Working with the plugin I noticed the text for the field types wasn't being translated (see screenshot below). I've had to call load_textdomain in the hook plugins_loaded to solve the problem.

translations

For now, I've only tested the 'Decimal number' type and due to _x wasn't working either, I changed that method for __. Anyway, I think the context in _x is no necessary.

$this->name = __( 'Decimal number (HTML5 field)', 'bxcft' );

ftena commented Jun 23, 2015

I've updated the main php file to solve a problem with translations.

Working with the plugin I noticed the text for the field types wasn't being translated (see screenshot below). I've had to call load_textdomain in the hook plugins_loaded to solve the problem.

translations

For now, I've only tested the 'Decimal number' type and due to _x wasn't working either, I changed that method for __. Anyway, I think the context in _x is no necessary.

$this->name = __( 'Decimal number (HTML5 field)', 'bxcft' );

@donmik

This comment has been minimized.

Show comment
Hide comment
@donmik

donmik Jul 13, 2015

Owner

Thanks for your great work. I'm going to add Decimal Number as a new type of field. The other two Gender and Diet are too specific I think. Gender is a type of field easy to create using the default types of fields from buddypress. Diet is a field that I don't think most users will need.

I'm checking old threads of support forum, so I hope I can release a new version updated with Decimal Number this week. Again thanks for your work.

Owner

donmik commented Jul 13, 2015

Thanks for your great work. I'm going to add Decimal Number as a new type of field. The other two Gender and Diet are too specific I think. Gender is a type of field easy to create using the default types of fields from buddypress. Diet is a field that I don't think most users will need.

I'm checking old threads of support forum, so I hope I can release a new version updated with Decimal Number this week. Again thanks for your work.

@donmik donmik closed this Jul 13, 2015

@ftena

This comment has been minimized.

Show comment
Hide comment
@ftena

ftena Jul 14, 2015

Hi donmik,

Yes, I agree with you. My first aim was to pull request changes only for the Decimal Number type, but GitHub also shows my other changes after the first pull request I made. Gender and Diet are useful in my case, but I understand these are very specific and not convenient for the most of users.

Please, take also into account the changes related to translations just in case you consider to add these changes to your code.

Thanks to you for your fantastic plugin.

ftena commented Jul 14, 2015

Hi donmik,

Yes, I agree with you. My first aim was to pull request changes only for the Decimal Number type, but GitHub also shows my other changes after the first pull request I made. Gender and Diet are useful in my case, but I understand these are very specific and not convenient for the most of users.

Please, take also into account the changes related to translations just in case you consider to add these changes to your code.

Thanks to you for your fantastic plugin.

donmik added a commit that referenced this pull request Jul 15, 2015

= 2.2.0 =
* Fixed undefined index. Thanks to jonatascabral. #19
* New type of field! Decimal number. Thanks to ftena. #20
* Fixed a bug with Website field. Sometimes the regular expression was giving false negatives. I've copied the regular expression from buddypress url field type.
* Fixed a bug with Checkbox Acceptance that does not let you create or update this field.
* Fixed a bug with Birthdate field type. Buddypress was throwing an error when user try to display age instead of birthdate.
* Updated description of plugin.
* Translations updated.

pluginmirror-worker pushed a commit to wp-plugins/buddypress-xprofile-custom-fields-type that referenced this pull request Jul 15, 2015

atallos
= 2.2.0 =
* Fixed undefined index. Thanks to jonatascabral. donmik/buddypress-xprofile-custom-fields-type#19
* New type of field! Decimal number. Thanks to ftena. donmik/buddypress-xprofile-custom-fields-type#20
* Fixed a bug with Website field. Sometimes the regular expression was giving false negatives. I've copied the regular expression from buddypress url field type.
* Fixed a bug with Checkbox Acceptance that does not let you create or update this field.
* Fixed a bug with Birthdate field type. Buddypress was throwing an error when user try to display age instead of birthdate.
* Updated description of plugin.
* Translations updated.

git-svn-id: https://plugins.svn.wordpress.org/buddypress-xprofile-custom-fields-type/trunk@1199403 b8457f37-d9ea-0310-8a92-e5e31aec5664

donmik pushed a commit that referenced this pull request Nov 17, 2015

atallos
= 2.2.0 =
* Fixed undefined index. Thanks to jonatascabral. #19
* New type of field! Decimal number. Thanks to ftena. #20
* Fixed a bug with Website field. Sometimes the regular expression was giving false negatives. I've copied the regular expression from buddypress url field type.
* Fixed a bug with Checkbox Acceptance that does not let you create or update this field.
* Fixed a bug with Birthdate field type. Buddypress was throwing an error when user try to display age instead of birthdate.
* Updated description of plugin.
* Translations updated.

git-svn-id: http://plugins.svn.wordpress.org/buddypress-xprofile-custom-fields-type/trunk@1199403 b8457f37-d9ea-0310-8a92-e5e31aec5664
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment