• Resolved stephunique

    (@stephunique)


    Hello

    I have been doing some testing and lately I have discovered that subscriptions do not expire after they are supposed to expire. I created several subscriptions and set them to have a 1-day validity, bought it as a test user using a test credit cart, then two days later, their subscription is still active and their user role has not changed.

    I am using WordPress 6.5.4 and PMS 2.12.2.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support madalinaruzsa

    (@madalinaruzsa)

    Hi @stephunique,

    Did you configure the cron job to run at the server level?

    There are two cron jobs: one that runs on the website level and one that runs on the server level. In order to be sure that everything works correctly my advice will be to contact your hosting provider and ask them if they can configure this website to make cron-job work on the server level.

    Especially, if you have a subscription plan with a duration of one day, the cron job must be configured at the server level. This is because the subscription expires when the cron job runs, and if it’s set to run at the site level, it only executes once a day. Proper configuration at the server level ensures timely execution and prevents any disruptions.

    To address this, please contact your hosting provider and request assistance in configuring the cron job to operate at the server level.

    For more detailed information about cron jobs, please visit Cron Jobs Documentation.

    Thread Starter stephunique

    (@stephunique)

    Hello,

    Thank you for your fast response.

    I am not a developer so I cannot write scripts or code, but I can access and do things in the hosting provider’s back end and edit php if I were provided with the right code.

    I have looked at how to edit the cron job for my hosting provider but it seems I have to upload some sort of script and have no idea what script or where to get one.

    I looked at the documentation page you recommended. I see there are some “daily cron job”s, such as “pms_cron_process_member_subscriptions_payments” and “pms_check_subscription_status” but I do not know how to use them.

    Update: The hosting provider said that the plugin makers (in this case Cozmolab) should provide a command for me to put in the back end of my hosting account (I know how to do th is but I don’t know the command). So now I need help with getting the right command to add.

    • This reply was modified 5 months, 1 week ago by stephunique. Reason: Add detail
    • This reply was modified 5 months, 1 week ago by stephunique.
    • This reply was modified 5 months, 1 week ago by stephunique. Reason: Add updates
    Thread Starter stephunique

    (@stephunique)

    Hello, I’d like to make an update and ask a follow-up question about how the timer for the subscription period and expiry works.

    Today is June the 20th. It has been 9.5 hours since my first post on this thread. When I first made this post, the one-day trial subscription that should have expired after one day, did not expire. Now, 9.5 hours later, I notice that it has now expired (I can tell be cause the user role that the subscription allocated is not allocated to the user anymore). I haven’t done anything to make this happen.

    So here is my question: How is the duration for the subscription period, and thus the expiry time, calculated and is this also dependent on the cron job update frequency? Because I “purchased” the one-day trial on June 18th (at what time, I forgot, but it would have been the evening) and would have expected it to last one day, ie 24 hours and expire 24 hours later on the 19th of June. Instead it had basically around a whole 24 hour more than one day and expired on the 20th of June in the evening my local time.

    Going by this, would a 30 day subscription be 31 days instead? Or does the day the person first subscribe, does not count? Ie if they subscribed on the 18th, the counter starts from say midnight 19th and expires on midnight of the 20th? I would like to add that at the time of subscribing (on the 18th), there was a message saying it would expire on the 19th, which obviously did not happen but I was waiting to see what hour on the 19th it expires, when in reality it expired on the 20th.

    Thank you.

    • This reply was modified 5 months, 1 week ago by stephunique. Reason: Add detail
    Plugin Support madalinaruzsa

    (@madalinaruzsa)

    Hi @stephunique,

    1. How to set-up cron job on server level.

    To ensure WP-Cron functions properly on your server, you don’t need to configure anything specifically for PMS. Instead, you need to set up a cron job according to your hosting provider’s requirements.

    For example, if you are using SiteGround, you need to follow this guide on setting up a cron job.

    Please share this documentation with your hosting provider and ask them for assistance in setting up the cron job.

    A note regarding the above documentation: For greater accuracy, please set the cron job to run every minute instead of every 30 minutes.

    2. Going by this, would a 30 day subscription be 31 days instead? Or does the day the person first subscribe, does not count?

    No, the first day is counted. For example, if you subscribe to a plan on June 1st, your subscription will expire on June 30th. However, when you have a subscription plan with a duration of 1 day, and the cron job is configured to run at the website level, the cron job runs only once every 24 hours.

    For example, on your site, let’s say the cron job runs at 2 AM.

    So, if the cron job ran at 2 AM on June 18th, 2 AM on June 19th, and 2 AM on June 20th, here’s what would happen: If you purchased the subscription plan on June 18th at 8 PM, the next cron job at 2 AM on June 19th would recognize the subscription as new and leave it active. Only when the cron job runs again at 2 AM on June 20th, it sees the subscription period has ended and marks it as expired.

    If you set the cron job to run at the server level as explained in point 1, the cron job will run every minute. So, if you purchase a subscription plan on June 18th at 8 PM (as in the example above) the cron job runs every minute. Therefore, it will also run on June 19th at 8 PM and mark the subscription plan as expired.

      Thread Starter stephunique

      (@stephunique)

      Thank you for the explanation as to why the subscription lasts a lot longer than 24 hours when I set the trial period of 1 day. I will ask my hosting provider for assistance and come back here with the results when I get a chance. Thank you.

      Thread Starter stephunique

      (@stephunique)

      Hello @madalinaruzsa

      I contacted my hosting provider, and they said that they understand the help guide you provided (the siteground link), but they still “need the actual command from your plugin support as well, every cron has separate command and functions so it needs to be asked with your plugin support.” so I need the command to run the cron job every minute. Do you have this command?

      Plugin Support madalinaruzsa

      (@madalinaruzsa)

      Hi @stephunique,

      As mentioned earlier, setting up a cron job at the server level is independent of the PMS plugin. Therefore, there is no specific command from the plugin that we can provide for this purpose

      The command is specific to WordPress as they just need to run that cron at the server level. As you can see in the example I provided here: How to Set Up a Real Cron Job for WordPress.

    Viewing 7 replies - 1 through 7 (of 7 total)
    • You must be logged in to reply to this topic.