• We’re trying to use the ‘features’ component to add features to an EDD software license. The features are things like ‘trial’, ‘unlimited’, ‘perpetual’, etc. The features are defined on a download and then copied to the license when it is generated.

    Writing the code is straight forward. The problem we are having is using EDD and Download Info together. The problem is the timing of the taxonomy registration. It is registered in the ‘init’ action. However, so is the EDD purchase process. Because both actions are registered with the default priority, the purchase process is run by EDD before the taxonomy is registered (because ‘easy-digit…’ comes before ‘edd-down…’). As a result the application fails.

    Is there any action that you believe can or should take place before the taxonomy is registered? If not, it would be great if the registration takes place with a priority of, say, 1 so no other action beats it (as EDD does) or register the taxonomy in the ‘setup_theme’.

    https://www.ads-software.com/plugins/edd-download-info/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Sami Keijonen

    (@samikeijonen)

    So are you suggesting that we should use priority 1 here in init hook?

    https://github.com/samikeijonen/edd-download-info/blob/master/includes/taxonomy.php#L10

    I noticed that I have also problems with that taxonomy. Anyways I look into it.

    Thread Starter bseddon

    (@bseddon)

    Yes, or some other mechanism to ensure the taxonomy is registered before the purchase process is run. I raised the issue on Pippin’s forum first to suggest he uses a priority like 100 to give other EDD plugins like yours chance to run. He was not so keen and correctly observed that it’s not really a general solution (though it would work in this case).

    Plugin Author Sami Keijonen

    (@samikeijonen)

    I’m not sure is it about purchase process.

    EDD is registering post types in priority 1.
    https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/master/includes/post-types.php#L124

    And custom taxonomy in priority 0.

    https://github.com/easydigitaldownloads/Easy-Digital-Downloads/blob/master/includes/post-types.php#L246

    So I’ll test priority 0 for this plugin too. Feel free to test it too.

    Thread Starter bseddon

    (@bseddon)

    <<I’m not sure is it about purchase process.>>

    OK, i was not being precise and simply recommending a change because we experience a conflict and know the cause (because we spent many hours studying it) and how it can be solved.

    You can review a detailed description of the problem and why a change to the priority of the features taxonomy registration is a solution here:

    https://easydigitaldownloads.com/support/topic/edd-actions-have-no-defined-priority/#post-86028

    Here’s a summary. The EDD ‘edd_complete_payment’ action causes the EDD Software Licensing ‘store_licence’ to fire and it’s this action we hook to copy feature definitions from the download to the license.

    Ulimately ‘edd_complete_payment’ occurs because ‘edd_post_actions’ is registered as an action with a default priority. Because EDD uses a default priority and you use a default priority WordPress runs the actions in the order they are registered. EDD wins because it comes before your plugin alphabetically. The result is that by the time our code is run, your taxonomy is not registered.

    This issue has nothing to do with post types or custom taxonomies but about the action hooks and priorities you and Pippin have chosen to use. I can see that you would both think that choosing ‘init’ as the action and using a default priority is a reasonable thing to do. However I represent a scenario in which that reasonable assumption is tested.

    Plugin Author Sami Keijonen

    (@samikeijonen)

    Here’s a summary. The EDD ‘edd_complete_payment’ action causes the EDD Software Licensing ‘store_licence’ to fire and it’s this action we hook to copy feature definitions from the download to the license.

    This is the part I don’t understand. Why would you want to use download feature taxonomy tight up in the licensing system? Download feature taxonomy is just like download category or tag, nothing more.

    And if it’s something custom that you need in your site I would create my own taxonomy for that so that you have full control when it’s loaded.

    The problem that I noticed was that I was receiving 404 page when using download feature taxonomy. With priority 0 it works again.

    Thread Starter bseddon

    (@bseddon)

    The software licensing extension to EDD is really only for WordPress plugins. It pays lip service to other types of software but apart from exposing an API that any software could call doesn’t really support anything other than WordPress.

    In our scenario we sell client software. Clients can buy single use licenses, they can by corporate unlimited use licenses. They can pay annually or buy a perpetual license. They can request a trial. Each of these is a ‘feature’ that we can attach to any download. However, the same download may be a trial for one user or a perpetual license for another. So we want the ability to have the ‘features’ attached to the license so we are able to vary them by license (and we’ve created a plugin to do that). However we want to initialize the license by copying features from the download to the license.

    So we have a choice. We can use an existing plugin which already offers the ability to attach features to a download or roll our own. It seemed rational to choose an existing plugin.

    But our rationale is not really relevant. What I’m trying to do is illustrate that in a scenario we’ve encountered and have tried to describe, there is a problem. My scenario is a little more obscure. But what if I want to include the features in my PDF receipt so the buyer can see what they purchased. The same problem occurs and for the same reason.

    We have a solution because we can edit your taxonomy.php file and change the taxonomy registration priority. But next time the download info plugin is updated we lose that change and run the risk that we introduce an error unless we remember to make the change.

    If you can’t see the need to make the change, that’s OK. But please let me know so we know to merge your plugin into our own so we can avoid future issues.

    Plugin Author Sami Keijonen

    (@samikeijonen)

    This is the only change I’m gonna make.

    https://github.com/samikeijonen/edd-download-info/commit/ec8d04b7212934d25ce8cefbc4650960471b5986

    But like I said, in your scenario simplest and most future proof solution is to make your own plugin and register custom taxonomy in there.

    I have many custom plugins in my site too.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Issue with the time of the taxonomy registration’ is closed to new replies.