Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

ftena
Copy link

@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
Copy link
Author

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
Copy link
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
Copy link
Author

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
* 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
* 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
* 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants