Easy-digital-downloads: EDD_License does not properly support `item_id`

Created on 21 Nov 2016  路  16Comments  路  Source: easydigitaldownloads/easy-digital-downloads

When passing a product ID to EDD_License instead of the product name (item_id instead of item_name), the shortcode for the license is not set, resulting in no name being displayed and verification failure for the license:
screen shot 2016-11-21 at 1 25 26 pm
screen shot 2016-11-21 at 1 29 46 pm

We'll have to resolve this in some way before we can start updating extensions to use item_id instead of item_name.

type-bug

All 16 comments

@pippinsplugins How would the item_name be fetched if only an item_id is supplied? It's my understanding that a license can't be activated if an item_name isn't passed?

We may need to require that item_name be supplied as well for the licensing page to show properly. The important part is that item_id get passed to the API.

We would need to add an extra parameter to the constructor for it to work then

PR opened at #5375

@pippinsplugins @cklosowski Is this ok to merge?

I think so but need to test updating an extenson for it to confirm.

If item_name is still required, does that mean it still needs to match the store product title as well? If so, introducing item_id didn't solve the problem it set out to solve.

No, item_name will only be required in order to set the name shown on the Licenses tab. EDD SL will use item_id for all verification.

Tested and works with PDF Invoices 馃帀

Merged

Hi!

What about activate_license and other methods? They are still use item_name instead of item_id.

@upsellpl All methods accept item_id as a parameter.

@cklosowski are we talking about this file:
https://github.com/easydigitaldownloads/easy-digital-downloads/blob/master/includes/class-edd-license-handler.php

I see e.g.:
public function activate_license() {
and inside:
$api_params = array( 'edd_action' => 'activate_license', 'license' => $license, 'item_name' => urlencode( $this->item_name ), 'url' => home_url() );

Did I miss something?

All methods (at the server level) accept IDs or Names. Specifically we register with a 'name' so that we can display it within the administration view to license keys.

Supplying the ID is currently only used in the 'auto updater' portion of the license handler.

Is there a use case where you are seeing unexpected results? Can you provide some context to your concern of it still using the name? We still support the name _and_ ID being sent in with the registration of a new license handler, to allow some flexibility with display in the admin and some calls to the APIs.

We can open up a new issue to add more support for the Item IDs, but the scope of this initially was to fix a bug when the Item ID was supplied. I'll open one for the 3.0 release to support sending the item ID as well, so long as it doesn't pose any compatibility issues.

@cklosowski correct me if I'm wrong: if I have an extension and sell it in the own shop. I can't change its name (on shop side) because EDD_Licensse won't activate it, right? But when the ID will be passed it should work.

@upsellpl yeah, that's the case, you'd need to keep that name the same, or write code on your store to 'translate' that name change.

Once EDD Core supports the id it should work by just using the ID, we go to the ID first and then fall back to the name in the event that the ID does not exist in the software licensing updater class.

Was this page helpful?
0 / 5 - 0 ratings