Allow user field as a float and/or int number

I want to use a user field as some points/credits earned, as a float number or an integer.
but its type could be a string, but not a number.
could save numbers as string, but the column would not sort by the value correctly…

say, I have a user field defined as credits_earned as below, they will be sorted as text in a wrong order.

123.45
23.34
3.23
9.31

and want to sort it as numbers like this instead…
3.23
9.31
23.34
123.45

some workaround? or will log a feature request, thanks…

You can do that in a plugin. Are you not doing this on a plugin?

I’m planning a blog post about how to create a plugin that pulls a value from a remote api and sets group membership.

2 Likes

hey, Jay, thanks for the reply

  • I am using the webhook function and API to update the user field,
    the issue is not about how to use the user filed with a plugin or other way.

  • the issue is, the user field data type is string, the value we need to save for each user is a float number.

  • now, could save the float number as a string in this user field added, but on the user page user list table, this column does not sort correctly, since it sorts as a string, not as a number…
    as the example in my post above…

hope a user field could be a number type (int or float)

thanks…

1 Like

I see. That’s a feature request to have custom user fields be floats. Seems reasonable. Until then, you’d need a plugin to make such a custom user variable.

3 Likes