Support » Plugin: Software License Manager » How to create license key for specific product?

  • Than you for your great work on this plugin, helped alot.

    Here is my problem:

    I have 2 different products, and I want to license them with one WordPress server.

    If I create a license key (with “Product Reference” filled) for one of the products seems this key can activate both of the products.

    Even I add a “&item_reference=XXX” in activation query url, the activation result will always go success.

    That is to say, if a key with product reference “product_A”, can activate product “product_B” with:

    https://site.com/
    ?secret_key=[Key with product reference A]
    &slm_action=slm_activate
    &license_key=…
    &registered_domain=domain.com
    &item_reference=[product_B]

    it will go success, with “message”:”License key activated”.

    I don’t use WP eStore Plugin ( payment method not work on my region), How can I create license key for specific product?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi,

    Please check the following documentation https://www.tipsandtricks-hq.com/software-license-manager-plugin-for-wordpress. Let me know if this helps you.

    Thank you

    Thank you for your reply, unfortunately the document didn’t help me.

    Whatever I write in “Product Reference” field, the key will respond “success” to ‘slm_check’ or ‘slm_activate’, even the “&item_reference=XX” is different in request query.

    How is that happend? sould I add another parameter with the query?

    https://site.com/
    ?secret_key=[Key with product reference A]
    &slm_action=slm_activate
    &license_key=…
    &registered_domain=domain.com
    &item_reference=[product_B]
    • This reply was modified 4 months, 2 weeks ago by Duke Yin.
    Plugin Support mbrsolution

    (@mbrsolution)

    Hi, I have submitted a message to the plugin developers to investigate further your issue.

    Thank you

    Hi @mbrsolution
    is there any further news about this issue?

    
    // check "Product Reference" on the activation/deactivation of a license key
    add_action('slm_api_listener_slm_activate', 'check_license_and_product_on_slm' );
    add_action('slm_api_listener_slm_deactivate', 'check_license_and_product_on_slm' );
    function check_license_and_product_on_slm() {
       if (isset($_REQUEST['item_reference'])) {
          $product_ref = sanitize_text_field(urldecode($_REQUEST['item_reference']));
          $key = trim(strip_tags($_REQUEST['license_key']));
    
          global $wpdb;
          $tbl_name = SLM_TBL_LICENSE_KEYS;
          $sql_prep1 = $wpdb->prepare("SELECT * FROM $tbl_name WHERE license_key = %s", $key);
          $retLic = $wpdb->get_row($sql_prep1, OBJECT);
    
          if ($retLic && $retLic->product_ref != $product_ref) {
             $args = (array('result' => 'error', 'message' => 'Your license key was not issued for this product'));
             SLM_API_Utility::output_api_response($args);
          }
       }
    }
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.