• Resolved mashour06

    (@mashour06)


    Hello,

    I don’t know if this is the best place to ask, but I’d like to programmatically check which version of TP (free – personal – business – developer) is used on a website.

    I’d appreciate it if you could answer my question, or guide me to any resource that explains how.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Daniel

    (@danieldandu)

    Hello @mashour06 ,

    Thank you for your message.

    You can use the following function to determine which TranslatePress tier is currently active on the website:

    function my_get_translatepress_tier() {

    if ( ! class_exists( 'TRP_Translate_Press' ) ) {
    return 'not_active';
    }

    $product = TRP_Translate_Press::set_tp_product_name_static();
    $tier = reset( $product ); // pulls the name string from the array

    switch ( $tier ) {
    case 'TranslatePress':
    return 'free';
    case 'TranslatePress Personal':
    return 'personal';
    case 'TranslatePress Business':
    return 'business';
    case 'TranslatePress Developer':
    return 'developer';
    default:
    return 'unknown';
    }
    }

    This will return not_active if TranslatePress is not active, or free, personal, business, or developer depending on the active TranslatePress tier.

    I hope this helps!

    Thread Starter mashour06

    (@mashour06)

    Hello Daniel,

    Thank you very much for your help, I really appreciate it. I’ll give it a try and let you know if something goes wrong.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.