Viewing 9 replies - 1 through 9 (of 9 total)
  • Jessica Oros

    (@jessica-o)

    Hey there,

    I’m not too familiar with BuddyPress, but it looks like your variable $data is an array, which you can’t compare with a string like that. You might need to get the correct array key for the data you want, or you could possibly use in_array() (https://us1.php.net/in_array)

    Hope that helps!

    Thanks,
    Jess

    Thread Starter gotard

    (@gotard)

    Hi Jessica,

    I did some changes on the https://www.paidmembershipspro.com/wp/pmpro-customizations/

    Can you please just give-me your opinion on it? https://pastebin.com/ssXj71ad

    Thanks

    Jessica Oros

    (@jessica-o)

    It doesn’t look like you changed anything where the issue was previously – lines 48-54. If your variable $data is an array, this will always return false. You need to check for “Portugal” in the returned data with in_array() like so:

    if(in_array("Portugal", $data)) {
         // your code
    }

    Thread Starter gotard

    (@gotard)

    So, you are saing that I must replace this: ‘if ( $data == ‘Portugal’ ) {?>’

    by this; ‘if(in_array(“Portugal”, $data)) {?>’?

    Great H-master

    (@great-h-master)

    Hello. Yes go ahead and try that. Your variable $data is referring to an array, so when you do $data == ‘Portugal’ it would return false. Using the code above from Jessica should fix that issue. Let us know what happens. Thanks.

    Thread Starter gotard

    (@gotard)

    Hi there!

    My old code was (is) working…

    I’ve tried to replace my old code by the code of Jessica and it stop adding the vat percentage when the user has “Portugal” on his profile

    I’ve made a pastebin of it so it can be useful to others and continue the discussion in order to improve this solution

    Should I fork this on github?

    The original is hosted here: https://gist.github.com/strangerstudios/6650073#file-pmpro-customizations-php

    Great H-master

    (@great-h-master)

    Hello. Good to hear you got things working. You are welcome to fork the original in Git Hub, we encourage PMPro users modify and contribute code that suites their needs. Thanks.

    Marking this as resolved.

    Marking this as resolved.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Non-US Taxes’ is closed to new replies.