Simon Crone

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
Mar 22, 2024 at 2:04 am
#194150
Participant
Simon Crone
OP

Almost there!

This is what I have done.

1. I have a package that only allows access for “subscriber” role (package id of 123).
2. If no user is logged in then download button is set to “Register to Unlock” as the “Login Required Message” (under Settings->General) is set to:

<a href="https://mysite.com/wp-login.php?action=register">Register to Unlock"</a>

3. Once registered, the user is assigned the “customer role” by default.
4. Since the user role is not “subscriber” the download button now shows “Generate Key” as the “Permission Denied Message for Packages” (under Settings->General) is set to:

<a href="https://mysite.com/?add_to_cart=123">Generate Key</a>

5. The cart is shown with the added package and the user can then complete the order ($0 cost)
6. The license key is generated and the user role “subscriber” is added to the user.
7. Thus the download button from now on allows direct download to the package.

Works well….

The only drawback is that if I am to create a second package for download with the need for a different license key, then the user is already assigned the “subscriber” role so the download button will bypass the purchase order process. I will have to create a custom role for each package.

Hope this is useful for someone.

Mar 21, 2024 at 6:40 am
#194083
Participant
Simon Crone
OP
This reply has been marked as private.
Mar 1, 2024 at 5:14 am
#193468
Participant
Simon Crone
OP

Nayeem,

I have only got it partially to work.

This works:
If the user is not logged in, then the “add_to_cart” button works and the user is taken to the cart.
There they can login (or register), the discount is applied and the complete payment button shows which they click.
The license is then generated and they are taken to the purchased page and see the order and newly generated license key.

However this doesn’t work:
If the user has registered and logged in then there is no way of adding the package to the cart to purchase it as the add to cart button has been turned into a direct download button. thus it downloads the package without generating a license key.

I realise that a logged on user doesn’t need to generate a new key every time the redownload the package.
Is there a way to check if a package has been purchased before it is downloaded?

Simon.

The. issue is that the license key is only generated when processing checkout.
If a customer is logged in then

Feb 29, 2024 at 7:02 am
#193424
Participant
Simon Crone
OP

Thanks I’ll give it a try and get back to you.

Viewing 4 posts - 1 through 4 (of 4 total)