Have you tried using the “dec” parameter to show the number of decimal places? By default, the plugin rounds off to zero.
For example,
[calculate dec=”2″]6.7+4.5[/calculate]
Even with the decimal parament, the answer is still zero. Its as if it is converting the mycred balance shortcode to zero.
For example this is what i have and it is resulting to zero [calculate dec=”2″][mycred_my_balance type=”level”]*2[/calculate]
The level here is 4
Just retested it with a shortcode that returns a decimal value. It seems to be working fine here. The plugin uses the standard “do_shortcode” to evaluate internal shortcodes, so it should return the same thing…
You’ve updated the plugin to the latest version? I didn’t add the “dec” parameter until 2.0 I think.
I’ve tried both with and without the decimal – the answer is zero. I have version 2.1 installed.
What value is [mycred_my_balance type=”level”] returning?
In this case 4 but it has a prefix so its L4 which am suspecting could be the cause of the problems. Does the plugin strip off any prefixes before calculations?
-
This reply was modified 7 years, 10 months ago by
jaredj.
The plugin just accepts numbers as inputs. If the input is not a number, it won’t work correctly!
What you could do is place the “L” before the [calculate] shortcode and just supply the number instead.
Like L[calculate dec=’2′][mycred_my_balance][/calculate] or something like that.
What I meant was the shortcode returns a number which can also be formatted with a symbol/text prefix. In the example, 4 or L4
But even when the shortcode returns a plain number trying to calculate returns 0
Would you like to have a look at a site with the two plugins installed? Maybe my explanation is not painting a very clear picture
Sure, let me have a look.
I’ve sent the link through your site
Hi, just sent you a message asking if it’s possible to give me login details so I can debug the plugin…
I might have an idea of what’s wrong.
-
This reply was modified 7 years, 10 months ago by
bhagwad.
Thank you for troubleshooting. It now works perfectly after stripping all the extra formatting the shortcode provides.