• Hi,

    I would have, if possible, a couple of interesting features:

    1) Is it possible to run a script (php) after the purchase and insert the output into the email? It also would be nice to pass to the script some parameters (like user name, etc).

    2) Download a free file (e.g. a demo) without to pass for checkout. Otherwise this could be seen by users as a way to pay for free demo.

    Thank you!

    https://www.ads-software.com/extend/plugins/easy-digital-downloads/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Pippin Williamson

    (@mordauk)

    1) Yes, absolutely. Are you familiar with WordPress action hooks?

    2). This won’t be possible as the email / user info is required for processing file downloads.

    Thread Starter Kjow

    (@kjow)

    1) Unfortunately, not. But I could try! I will look for tutorial about these.
    What do I need to do with action hooks?

    2) Ok, so I need a download manager for free files and “Easy Digital Downloads” for purchases. ??

    Thank you!
    Kjow

    Plugin Contributor Pippin Williamson

    (@mordauk)

    1) I can show you a simple example. Do you want to run a function when a purchase is first made, or when its payment is confirmed as complete?

    2) If you want to avoid the checkout process, yes.

    Thread Starter Kjow

    (@kjow)

    1) Yes, thank you!
    At the moment I need when the payment is confirmed as complete.

    ??

    Plugin Contributor Pippin Williamson

    (@mordauk)

    Here you go:

    function pw_runs_when_payment_complete($payment_id, $new_status, $old_status) {
    
    	if( $old_status == 'publish' || $old_status == 'complete')
    		return; // make sure that payments are only completed once
    
    	if( ! edd_is_test_mode() ) {
    
    		$payment_data 	= get_post_meta($payment_id, '_edd_payment_meta', true);
    		$downloads 		= maybe_unserialize($payment_data['downloads']);
    		$user_info 		= maybe_unserialize($payment_data['user_info']);
    		$cart_details 	= maybe_unserialize($payment_data['cart_details']);				
    
    		// run something for each product purchased
    		foreach($downloads as $download) {
    
    			// $download['id'] is the ID number of the product purchased
    			// $payment_data, $user_info, and $cart details contain a lot of other info you might need.
    
    		}
    
    	}
    
    	// empty the shopping cart
    	edd_empty_cart();	
    
    }
    add_action('edd_update_payment_status', 'pw_runs_when_payment_complete', 10, 3);
    Thread Starter Kjow

    (@kjow)

    Thanks, I will try soon!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Easy Digital Downloads] Features request’ is closed to new replies.