Bug report: lmfwc_add_license function
-
Hi. The lmfwc_add_license function in functions/lmfwc_license_functions.php has a bug. If user_id is supplied in the $licenseData parameter, it will overwrite the product_id:
if (array_key_exists('product_id', $licenseData)) { $productId = $licenseData['product_id']; } if (array_key_exists('user_id', $licenseData)) { $productId = $licenseData['user_id']; }
Furthermore, even if user_id was correctly assigned to a variable, it would still not be written to the database, since the $queryData array is missing the user_id key:
$queryData = array( 'order_id' => $orderId, 'product_id' => $productId, 'license_key' => $encryptedLicenseKey, 'hash' => $hashedLicenseKey, 'expires_at' => $expiresAt, 'valid_for' => $validFor, 'source' => LicenseSource::IMPORT, 'status' => $status, 'times_activated_max' => $timesActivatedMax );
Here is corrected code:
if (array_key_exists('user_id', $licenseData)) { $userId = $licenseData['user_id']; } // later... $queryData = array( 'order_id' => $orderId, 'product_id' => $productId, 'user_id' => $userId, // etc... );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Bug report: lmfwc_add_license function’ is closed to new replies.