WordPoints / wordpoints

Points plugin for WordPress
GNU General Public License v2.0
20 stars 15 forks source link

Function to deformat points #149

Closed JDGrimes closed 7 years ago

JDGrimes commented 10 years ago

We have the wordpoints_format_points() function to apply formatting to points, like a suffix and prefix. It would be nice if we introduced a wordpoints_deformat_points() function which could reverse this, converted the formatted points type back into a raw integer. The benefit of this is that it would be more generous when users enter points values into forms, for example. I can see it being especially good if points are being formatted with a decimal. However, there would still be other things to overcome there, like how to deal with an integer value entered with no decimal at all. That would be an ambiguous case. It could be handled by assuming that the decimal was implied to be after the number, but this wouldn't be backward compatible. That doesn't affect core in any case, but it is something that would need to be considered.

JDGrimes commented 7 years ago

Currently I don't think that this is really of value right now, since we are using number inputs for all points values after #181. So our primary (only?) use-case is no longer valid. If we decide to allow decimal points values, there will be much more that will need to happen here, so let's close this for now.