• Resolved searchngp

    (@searchngp)


    I love the concept. I have mycred plugin installed and am wondering if it is possible to do calculations with balances produced by mycred shortcodes. For example [mycred_my_balance] shows the user’s point balance for a specific point type. If there are many point types, is it possible to do calculations – I tried and it shows zero, not sure why

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author bhagwad

    (@bhagwad)

    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

    Plugin Author bhagwad

    (@bhagwad)

    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.

    Plugin Author bhagwad

    (@bhagwad)

    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 6 years, 4 months ago by jaredj.
    Plugin Author bhagwad

    (@bhagwad)

    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

    Plugin Author bhagwad

    (@bhagwad)

    Sure, let me have a look.

    I’ve sent the link through your site

    Plugin Author bhagwad

    (@bhagwad)

    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 6 years, 4 months ago by bhagwad.

    Thank you for troubleshooting. It now works perfectly after stripping all the extra formatting the shortcode provides.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Calculating other plugins’ is closed to new replies.