Giter Club home page Giter Club logo

Comments (9)

devinsays avatar devinsays commented on July 20, 2024

The theme shop API would to provide the renewal link for edd_get_checkout_uri to work. Perhaps the JSON response could add that rather than us coding it.

But that's one reason I also added the "renew_url" param. If you were using a custom link structure, you could build your own link.

from edd-theme-updater.

samikeijonen avatar samikeijonen commented on July 20, 2024

Makes sense, thanks.

from edd-theme-updater.

shazahm1 avatar shazahm1 commented on July 20, 2024

I use this to provide a renewal link

/**
 * Add the renewal checkout URL to the remote license check response.
 * 
 * @param  array  $response   The response array.
 * @param  array  $atts       The atts for EDD_Software_Licensing::remote_license_check()
 * @param  string $license_id The license key.
 * @return array              The response array.
 */
function cn_remote_license_check_response( $response, $atts, $license_id ) {

    // Ensure the required functions exist; if not return $response.
    if ( ! function_exists( 'edd_sl_renewals_allowed' ) && 
         ! function_exists( 'edd_software_licensing' ) &&
         ! function_exists( 'edd_get_checkout_uri' ) ) {

        return $response;
    }

    // Ensure the license key exists; if not return $response.
    if ( ! isset( $atts['key'] ) || empty( $atts['key'] ) ) {

        return $response;
    }

    // If license renewal is not permitted; return $response.
    if ( ! edd_sl_renewals_allowed() ) {

        return $response;
    }

    // No need to add the checkout URI to the response if the license is not expired.
    if ( $response['license'] !== 'expired' ) {

        return $response;
    }

    // Bring into scope the EDD SL Class.
    $licensing = edd_software_licensing();

    // Get the download ID from the license key.
    $download_id = $licensing->get_download_by_license( $atts['key'] );

    // If the download ID was found, add the renewal URI to $response.
    if ( $download_id !== FALSE ) {

        $response['renewal_url'] = edd_get_checkout_uri( array( 'edd_license_key' => $atts['key'], 'download_id' => $download_id ) );
    }

    return $response;
}

add_filter( 'edd_remote_license_check_response', 'cn_remote_license_check_response', 10, 3 );

from edd-theme-updater.

devinsays avatar devinsays commented on July 20, 2024

Thanks for posting @shazahm1. Did you see if @pippinsplugins was interested in a pull request? I think this would be a nice feature.

from edd-theme-updater.

shazahm1 avatar shazahm1 commented on July 20, 2024

@devinsays no, I haven't ... Honestly, I thought if enough people actually wanted it, it would already be in EDD-SL.

Since EDD-SL a commercial plugin, can't really submit a pull request.

from edd-theme-updater.

pippinsplugins avatar pippinsplugins commented on July 20, 2024

I definitely would love to see a pull request :)

from edd-theme-updater.

shazahm1 avatar shazahm1 commented on July 20, 2024

@pippinsplugins How would I submit a PR to EDD-SL? Or, would you want this in core somehow???

from edd-theme-updater.

pippinsplugins avatar pippinsplugins commented on July 20, 2024

I've just added you to the repo.

On Fri, Oct 3, 2014 at 9:48 AM, shazahm1 [email protected] wrote:

@pippinsplugins https://github.com/pippinsplugins How would I submit a
PR to EDD-SL? Or, would you want this in core somehow???


Reply to this email directly or view it on GitHub
#12 (comment)
.

from edd-theme-updater.

samikeijonen avatar samikeijonen commented on July 20, 2024

I was wondering if renewal link is now in EDD SL Plugin?

from edd-theme-updater.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.