Closed (duplicate)
Project:
User Points
Version:
master
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Sep 2008 at 14:31 UTC
Updated:
15 Mar 2013 at 21:18 UTC
Hi,
Over in #217359: Question: integer vs decimal?, you mention that instead of using decimals to represent userpoints, another option is to use integers (a penny a point) and display them divided by 10... so 550 points = $5.50 . Is there a single place where I can put the $points/10 code so that points will always display that way? Or do I need to write it out explicitly each time I call userpoints_get_current_points() for display?
Thanks!
Eileen
Comments
Comment #1
kbahey commentedThe points have always been an integer (no fractional points) and hence this use case have never been considered as a common one.
So, I am changing this to a feature request for making it a theme function, and then everyone can display them the way they want.
Patches welcome for this ...
Comment #2
jredding commentedunfortunately there is no single way of doing it..
for /userpoints you can use function theme_userpoints_list_users_row(&$row) {
Comment #3
kbahey commentedWhat I meant was :
Then this can be overridden in template.php by anything. In Eileen's case, assuming points represents cents, it would be:
As I said, patches to make this happen are welcome.
Comment #4
jredding commentedmoving this to head as I missed it in the latest run of new code.
Comment #5
kmillecam commentedWe've discussed the use of fractional points in the past.
Our site awards .5 points to users who vote on articles and .1 points
for users who click on an affiliate banner ad.
We had to hack the userpoints module to make this happen by:
1) modifying the database fields (points and max_points) to float instead of integer.
2) removing (int) from queries that pull point balances from the database.
3) changing %d to %f in cases where points where being handled.
HTH,
Kevin
Comment #6
jredding commentedwell the idea with moving it to a theme function is that you just /10 and then you have your half points.
i.e. where you normally award 1 point, award 10, .5 is 5 points then theme to make it display correctly.
It avoid some of the other issues that were discussed in the past (over on g.d.o).
Comment #7
jredding commentedman I should really read the entire issue before commenting. Sorry commenting when you're tired is never a good idea.
kmillecam, ya we've had this discussion before. My bad.
We should probably put this information into the handbook (i.e. why up use whole number and what you can do to switch its use)
Comment #8
mrfelton commentedThis is a dupe of #1643692: theme function implemented by michaek which was fixed already.