jdh1178

Forum Replies Created

Viewing 18 posts - 26 through 43 (of 43 total)
Mar 14, 2023 at 1:05 pm
#184795
Participant
jdh1178
OP

Awesome, thanks Shajada. Actually, that will be a lot more useful as well that my solution. Thanks 🙏

Mar 14, 2023 at 2:10 am
#184769
Participant
jdh1178
OP

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

Mar 14, 2023 at 2:01 am
#184768
Participant
jdh1178
OP

@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 🙂

Mar 13, 2023 at 5:19 pm
#184766
Participant
jdh1178
OP

Will try that tomorrow thanks

Mar 13, 2023 at 9:01 am
#184733
Participant
jdh1178
OP

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 );
Mar 13, 2023 at 4:44 am
#184717
Participant
jdh1178
OP

Nice one, thank you will do! Was going nuts yesterday trying to put the puzzle together 🙂

Mar 12, 2023 at 2:31 pm
#184701
Participant
jdh1178
OP

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’.

Mar 10, 2023 at 4:44 pm
#184652
Participant
jdh1178
OP

Thank you, will do

Mar 9, 2023 at 3:58 am
#184606
Participant
jdh1178
OP

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

Mar 8, 2023 at 5:29 pm
#184601
Participant
jdh1178
OP

That’s amazing, great thank you 🙏

Mar 8, 2023 at 3:58 am
#184543
Participant
jdh1178
OP

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.

Mar 7, 2023 at 4:13 pm
#184521
Participant
jdh1178
OP

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.

Mar 7, 2023 at 1:29 pm
#184505
Participant
jdh1178
OP

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

Mar 7, 2023 at 7:53 am
#184480
Participant
jdh1178
OP

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

Mar 6, 2023 at 11:58 am
#184442
Participant
jdh1178
OP

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

Mar 6, 2023 at 11:54 am
#184441
Participant
jdh1178
OP

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!

Jan 8, 2020 at 10:17 am
#117780
Participant
jdh1178
OP

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.

Jan 8, 2020 at 9:44 am
#117777
Participant
jdh1178
OP

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)