jdh1178

Forum Replies Created

Viewing 18 posts - 26 through 43 (of 43 total)

jdh1178
Participant

Awesome, thanks Shajada. Actually, that will be a lot more useful as well that my solution. Thanks ๐Ÿ™

in reply to: Renew item in an order? #184769

jdh1178
Participant

Yep, I’ve seen that. But I meant in the order details page when renewing an order to also use buy now buttons for individual items as an option of quickly renewing individuals. Will check the code and see how I can do it thanks


jdh1178
Participant

@Shahjada I don’t think that works unfortunately. It’s too ‘late’ and I still get the ‘Sorry! Support and Update Access Period is Already Expired’ message.

When using xdebug breakpoints before it seemed to me that immediately after clicking ‘download’ in order-details the first thing to occur was download() and the checks for status, before anything else.

I am currently running both the ‘filter’ hook (I suggested) and the ‘action’ (you suggested) and the filter definitely fires first according to debug.

Directly below the filter are the following checks:

` $expire_date = $odata->expire_date > 0 ? $odata->expire_date : ($odata->date + (get_wpdmpp_option(‘order_validity_period’, 365) * 86400));

if ($odata->uid != $current_user->ID && !Session::get(‘guest_order’)) Messages::error(__(“Invalid Access!”, “wpdm-premium-packages”), 1);
if ($odata->order_status == ‘Expired’ || time() > $expire_date) Messages::error(__(“Sorry! Support and Update Access Period is Already Expired”, “wpdm-premium-packages”), 1);`

Ive also disabled my theme templates and tried with core to be sure it isn’t something else I’ve modified interfering.

I think you can quickly reproduce the same issue if you’d like, but the code is pretty clear if you trace it :
1 – Edit user-order-details template (or core plugin) so that status allows complete and expired everywhere
2 – Add the action you supplied
3 – Try to download

You should see the ‘support/download access expired warning’.

4 – Add odata filter to wp-premium-packages before the checks in download() and it works.

Still having coffee so totally possible I missed something ๐Ÿ™‚


jdh1178
Participant

Will try that tomorrow thanks


jdh1178
Participant

Sure, in my case I needed to make download access available to ‘Expired’ orders in order details for example and make a system where customers continue to receive files/serials based on the latest version available to them at the time their order expired in order-details. No problems there – just checking file attachment update date against the expiry date for each version to allow download.

– However, because the download() runs checks against ‘expired/completed and expiration date’ I needed a way to modify this data temporarily so that it could pass the download() check when clicking the download button.

This was nearly impossible to do without a filter. I tried for a while and came up with some super dirty solutions using cookies, but I wasn’t able to in a way that was clean and didn’t rely on actually writing/rewriting over the order details.

With a hook, I just temporarily alter the order data before it passes the checks and problem solved.

function wpdmpp_modify_order_data_status( $odata, $oid ) {
	// Check order status and expire date
	if ( $odata->order_status == 'Expired' ) {
		// Modify order data here
		$odata->order_status = 'Completed';
		// Expired time set to 1 second in the future so that the download link will be seen as valid
		$odata->expire_date = time() + 1;
	}
	return $odata;
}

// Add filter
add_filter( 'wpdmpp_modify_order_data_before_download', 'wpdmpp_modify_order_data_status', 10, 2 );

jdh1178
Participant

Nice one, thank you will do! Was going nuts yesterday trying to put the puzzle together ๐Ÿ™‚

in reply to: Renew item in an order? #184701

jdh1178
Participant

I see, thanks. I suppose I can add buy now buttons to each item in the order as well if ‘expired’ and attach a renwal discount to those if needed. Hopefully if ‘role’ on purchase gets implemented, then I can just assign user a role for that product which should then get them future discount on ‘renewal’.


jdh1178
Participant

Thank you, will do


jdh1178
Participant

One question then, if there are no templates or actions what approach would one take to adding custom elements to the admin templates
Current solution is:

checks...then

    $screen = get_current_screen();
    if($screen && $screen->id === 'wpdmpro_page_orders') {
        $order_id = isset($_GET['id']) ? sanitize_text_field($_GET['id']) : '';
...

do stuff


jdh1178
Participant

That’s amazing, great thank you ๐Ÿ™


jdh1178
Participant

That’s great, thank you very much. Should work fine. We essentially sell a license to our users to use our software which is an add-on for another software that handles activations – zero possibility do anything more. :/ Wish it wasn’t so, but oh well…

Thanks again for your help.


jdh1178
Participant

One more question @Shahjada, with the hook will it be possible to generate licenses based on the quantity ordered? For example user orders 10 units, currently there is only one key generated despite having ordered 10. I have a requirement for this that’s unavoidable as the licenses are not managed by us and there is no api, so creating multi-user license out of the question. I imagine generating the keys with the hook should be easy enough or with a custom getKey function which I’ve written, but I’m not yet sure how they’re stored against the user/orders. Any input appreciated. Will start on this tomorrow I hope.


jdh1178
Participant

Nice one, thanks. I’ll go with that and then just double check it when it lands in the update. Much appreciated!

in reply to: Download snapshot versioning #184480

jdh1178
Participant

Ok, thanks I’ve already started working on it on my own and was just hoping for some developer feedback if there was a better approach. I’ll definitely ping you guys for customizations if needed. Cheers


jdh1178
Participant

Would be excellent, thank you. I’m using roles extensively to determine who has access to a dl package, but there is no way to assign the roles based on purchase. Do you know roughly when that might happen? Otherwise I will try to write something myself. Cheers


jdh1178
Participant

Ah nice one, a hook would be fantastic. I could then use 3rd party service like keygen to handle the keys but continue to manage them in download manager. Do you have a rough eta on when that might happen? I can start developing by just adding the hook in meanwhile if I know it’s coming soon. Thanks!

in reply to: Hiding Amazon S3 Link Url #117780

jdh1178
Participant

Can the time be shortened? It’s quite long and can be shared easily. Also, is it normal to have the AWS credential exposed there as well? Seems unusual.

in reply to: Amazon S3 #117777

jdh1178
Participant

Can I set the expiration time manually? 30 mintues is a long time for someone to do some damage sharing a link, and since your s3 links aren’t hidden and can easily be copy/pasted from the browser dev tools it’s quite insecure.

Viewing 18 posts - 26 through 43 (of 43 total)