Decimal used

Events happening in the community are now at Drupal community events on www.drupal.org.
khanmurat's picture

Hi, i want to use decimal system on userpoint plugin, i try to find but i can't reach the exact solution. This is what i've done in sql and userpoint.module in userpoint table: i've changed points and max_point values as 10.2 0.00 and i did the same thing on userpoint_txn then i've changed all the %d %f in userpoint.module

i got this results: i can add decimal points but these decimal points not seen on user points. for instance when i add 2.5 points to the user, i see 12.0 points. how can i do?

Comments

Remove (int) from db calls

kmillecam's picture

Hi khan,

I had to do the same thing to get userpoints to handle decimals.

You also have to change the functions that call database queries (remove the int from the beginning) or all they will return integers instead of decimal numbers.

Also, you have to slightly modify the database tables to hold decimal numbers.

HTH,
Kevin

Patch needs testing

kbahey's picture

There is a patch that needs testing here http://drupal.org/node/417830 that makes userpoints work with decimals.

If enough people test it and vouch for it, and help move the contrib to that new API (at least for D6) then it will be committed and become a feature of the standard module.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

kbahey thanks but this api

khanmurat's picture

kbahey thanks but this api dont work my site. I changes right code but admin/build/modules/list/confirm page is disclaim install. I was repeatedly chance but dont work. I need your help.

kbahey, i changed code but

khanmurat's picture

kbahey, i changed code but system write in userpoints page; "User khan earned 20.5 points Total now is 21 points." how change it?

This group is for discussion

kbahey's picture

This group is for discussions, not for support or reporting bugs.

Please comment on the issue in its right place if the patch does not work. Mark it as "needs work".

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

thanks you, i build it.

khanmurat's picture

thanks you, i build it.

User Points

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: