stephunique
Forum Replies Created
-
I am back to update this and finally close this thread as it has been resolved after some testing. I will leave a detailed summary for my own future reference and for other people who may find this helpful.
But first:
“The subscription expiration and activation determines the role that the user has” – this is exactly what I wanted, so that when the subscription expires, the user loses the user role that came with the subscription and have to purchase the subscription again in order to get access to whatever that user role gives them access to, eg a menu button, and now that I got it working, it is exactly what is happening.
Thank you @alexandrubodea very much for your help!
Here is the summary:
A lot of people want a way to allocate a user a single user role when they register, and charge for this process. The default method with Paid Membership Subscription (PMS) is that, you create a virtual subscription product that a user can pay for to have. When a user buys the subscription, they will become a registered user of your site. You set it so that the subscription allocates the user a wordpress user role (you can set the role to anything you want), then, when the user buys the subscription, the user will gain that user role. The issue for some of us is that PMS allocates a user the role the subscription is set to allocate, but the user also gains the wordpress default user role as well, meaning they get 2 user roles. This is an issue if we use methods that give permission to users based only on their user role – so we want PMS to give the purchasers a single user role only.
That is where the code at the start of this thread comes in: As of WordPress version 6.6.2 and PMS version 2.12.9, this code will make the user gain only one user role, and that is the user role the subscription gives them. When the subscription expires*, the purchased user role will be lost, and the user will get the site’s default user role.
*When the subscription expires depends on the chron job setting of your site (hosting back end), which “checks” something as often as you set it (eg once per minute, hour, day, month). This took some posts in support threads here and questioning with my hosting provider to find out. Ultimately, I had to wait for a while for the time to run out naturally due to complicated issues I won’t discuss here. Basically: the cron job needs to be set so it is in sync with the unit of time your subscriptions is set to expire/work in. Eg: if your subscription is valid for and expires after 1 DAY(S), like day passes on some sites, then your chron job probably needs to run every minute so it can check every minute whether exactly 24 hours have passed. If it is set to run once every 24 hours, then you could have a situation where the subscription runs a full 23 hours and 59 minutes longer than you intend it to, causing some people to lose subscription revenue (eg: if it is set to run once every 24 hours at 12 am midnight, but a user signs up for a day pass one minute later at 12:01am, they will get access right away, but the cron job won’t check for new registrations until the next 12am exactly, which is 23 hours and 59 minutes later. Then, the user will be given the 24 hour/1 day access they purchased, so they will get 23 hours and 59 minutes plus the 24 hours they purchased, leading to a total of 47 hours and 59 minutes. So initially when I checked back after 24 hours (for testing purposes I set it to 1 day’s subscription as opposed to 30 day’s subscription), none of the purchased subscriptions expired and the user never lost their role.
Hello,
Edit: The information below was checked before I updated my PMS version to 2.12.9. Then I saw there is an update, and updated the plugin. Thank you.
Regarding this:
->”The expiry of the subscription doesn’t have anything to do with the user role.”:
I thought that, if we create a subscription that allocates a user role to a buyer, then when they buy that subscription, they will get that user role (and using the code on this page, they should only get 1 role, which they do, so that is good). Then, when the subscripton expires, they should lose the role, and using the code on this page will result in the user gaining the site’s default role when the subscription expires.
->”you need to go to Paid Member Subscriptions -> Members -> and click on that member. There you can see the Status of the subscription plan and also the Expiration date.”
After waiting for some time*, it seems the subscription did expire , and the site’s default role is given to the user when their subscription expired. This is good. *This time is related to the cron job – I can fix that later, first I want to get this plugin up and running. I’ve created another test user and I will see again, if they expire in 2 days’ time.
->”Please provide the URL of the Registration form where you encounter this issue (from this specific site), so that I can also look at it.”
This is the URL of the test site, this is a test site and the content can change at any time: https://bandmemberswanted.com/pricing-2/
Thank you
- This reply was modified 1 month, 3 weeks ago by stephunique. Reason: Added info about plugin version
Back with another update:
I followed the instructions as above in this thread on two different test sites (live sites with an actual domain name, eg https://www.test1.com and https://www.test2.com) with almost the same set up (I say almost because they have different themes but apart from that I don’t think there are many differences) and I have different results for some reason.
One Test 1 site, the users who sign up are allocated a single role as the code says it should, and that rol is the role the subscription plan issues them. However, as I mentioned, even though I set it to never renew automatically, the subscription seems to never expire because the user role never changes back to the site default role.
On Test 2 site, users who sign up get this messge:
“Something went wrong while trying to process the payment. Your account has been created, so please log in and retry the payment.”
In the wordpress admin dashbaord, these users only get 1 role instead of 2 roles, but not the correct role: they do not get allocated the subscription user role, instead, only get the site’s default role.
When I retry the payment by logging in as a test user, I get this message:
“Something went wrong while trying to process the payment. Please try again.”
On both sites I have Test payment mode activated (PMS -> Settings -> Payment).
I have followed the directions and have bought a new subscription with a test user as a test, and will need to wait a few days for the result.
In the meantime: my site was set up in test mode because that allows me to make test purchases with test credit cards without making real purchases. Does that matter for the second step where you asked me to put the site in test mode then back to live mode?
Also: Thank you for the link, as a non-developer, I did not know about the types of cron jobs. I checked with my hosting provider and they said my hosting plan has a website level cron job and to get a server level cron job, I need to upgrade my hosting. At the moment, I do not want to upgrade, because I am simply testing out a specific set up of a website which includes using PMS, if everything is sucessful, I would roll it out on a proper site (including an upgraded server if needed). A the moment, I am held up with getting PMS to work properly. So: is there anything else I can do besides upgrading my server to access server level cron jobs, that would allow me to set up PMS and test it properly? So far, using the code provided earlier in this thread is working – it allocates a single user role to a purchaser, my only issue now is, it seems that the role doesn’t expire.
Thank you so much for your patience.
Hello
I followed the steps you gave me, and I believe the cron event was excecuted successfully, but I got a different messsage to the one you wrote. In Step 4, my messsage said “Scheduled the cron event?pms_check_subscription_status?to run now. The original event will not be affected.”. The users indeed had their subscriptions expired and they now lost their purchased subscription, and now have the site default user role.
Can you tell me how to proceed from here? Do I deactivate and reactivate PMS? What is supposed to do, reactivate the expired roles? Should I purchase a subscription again as a test to see what happens now? And do I need to run this every time someone subscribes/their subscription is due to expire? Just a little confused what is supposed to happen/I am supposed to do now.
Thank you so much
@dazzling I don’t work here but you should not post your email and phone number publicly, it is not safe. If you can, you should delete them.
This is a case where moderators should actually be doing their job and stepping in to remove such information, instead of restricting people’s accounts for posting negative reviewas/”support requests” in the review section.
Hi PMS
I tested the code in this thread and while it allocates a single user role, the subscription/role does not expire for some reason. Please have a look at this screenshot showing a test subscribed member: https://snipboard.io/tQL2yv.jpg
This is a one day subscription with a one day trial that renews daily with user opt-in renewal. As you can see, the subscription started on September the 10th and it even says “Next Payment” is on September 11th. Today is September 14th and it still says “Active” and the user role has not reverted to the site default role. I expected the subscription to fully end on September 12th, but I waited a whole extra day to pass in case it is a cron issue (previously there was apparently a cron job issue that prevented subscriptions from ending exactly on time – I could not get that fixed and didn’t want to go through the trouble of trying for this test site). but after an entire day (the 13th), when I checked on the 14th, it is still active.
Update: I tried this code on a fresh installation of WordPress on a different test site and this works – the user gets allocated 1 role and it is the role the subscription gives them. I set it to 1 day free trial and one day subscription in test mode. Previous issue might be a conflict with something.
Question: What timezone are the dates and times in for the subscription time? Asking because it is well after midnight for me here when I created the test users, and is technically the 11th of September, but when I went to PMS -> Members, it says the “start date” is “2024-09-10” and end date is 2024-09-12.
Thank you.
Hello,
Sorry it took so long for me to get back to this issue.
I tested this code snippet on an existing site as well as registering without this snippet. Here is what happened:
Without activating this snippet: When I registered a test user, the user got only one role and that was the site’s default user role, instead of the role associated with the plan. This is what my settings looks like:
https://snipboard.io/5fSONr.jpg
When I tried registering a test user with the code activated, the exact same thing happened, ie, one role was allocated and it was the site’s default role.
I put the payment on test mode and when I checked out, there was no payment processing form, not even for test credit cards. There was only a registration form. Then it showed this error: “Something went wrong while trying to process the payment. Your account has been created, so please log in and retry the payment.” Not sure if the user role issue is related to this.
Hello Jarryd,
Thanks for checking up on this thread. Actually my issue is not resolved, but you can leave this thread as resolved since I think I will find an alternative. I’ve created 2 test subscriptions using 2 test users and their subscription is set to run out tomorrow (it ends on 6th of September). I could not get PMP to connect with a Stripe in test mode – I only managed to do this accidentally once and don’t have a clue how I did it and cannot replicate it. So I created the 2 test subscriptions in my wordpress dashboard instead using the PMP test mode (ie test mode payment instead of stripe as payment). I had 2 days trial and 2 days subscription but I never got the trial ending email (which earlier you stated in a different thread that we can use the “subscription ending” email) nor the subscription ending email, only the sign up confirmation email (I used the code “recipe” for changing the reminder email from 7 days to 1 day before trial ends). Also it is now in the subscription period since the 2 day trial period has ended but in the member subscriptions tab in PMP, it still says “no subscriptions”.
I’ve been trying this plugin for several months and I’m sorry to say it has been way too much work for what it is worth, and I just can’t get it to work, which is a shame since it is the only plugin that has something remotely related to what I need but it is just too difficult to set up.
Thanks
- This reply was modified 2 months, 2 weeks ago by stephunique. Reason: Add detail
Thank you for your reply, but you didn’t answer my question at all, which was simply whether it was possible to avoid allocating the site’s default role when a user purchases a subscription to a user role using Sure Cart (since you already stated the Surecart role is unavoidable, meaning they will have that role, and I also want to allocate them a role for making the purchase, resulting in 2 roles), and now I have to spend time to write a lengthy response to you.
To answer your question: I am using several different plugins that determine whether a user role can have a function (not a wordpress “capability/permission”) or not. These functions are like “can this user role see others listed in a directory or not” or “should this user role be listed in the public directory” or “should this user role be featured”. This logic is actually very easy to understand and simple, which is why I am simply looking for a way for users to “buy” a subscription to a user role that would open them to all sorts of possible actions on my site. The settings in the plugins I use require you to choose an option for each user role, which would clearly result in a conflict if one user has more than one role and the roles do not have the same permissions. If the site default role is a subscriber and their permission is “this role is not listed in the directory” and a premium role (that I sell as an upgrade) “this role is listed in the directory”, and a user gets both of these roles when they sign up through SureCart (since purchasing through SureCart will result in getting the site’s default role as well as the user role they purchase through the User Roles integration, not to mention a 3rd role which is SureCart Customer or whatever it is called exactly), clearly there will be a conflict: will this user be listed or not in the directory?
The fact that a user role starts with “no permissions” to start with, is entirely irrelevant. Most of the plugins I use are dependent on another plugin that requires setting up, so the simplest one to demonstrate the issue “Role Based Storage Limiter”. In the settings, you must allocate storage space for each user role, either a number eg 5mb 10mb or “unlimited”. If the site’s default role, no matter what it might be, is allocated 0mb, but a premium role has 10mb, and a user buys a subscription for a premium role, they will get the site’s default role and be allowed 0mb of storage and when they try to upload anything, they will fail. Meanwhile, because they bought a premium subscription, they are supposed to have 10mb of storage, so when they upload something, they can upload 10mb of files. In this case, will they be restricted or not? This is the conflict I was talking about.
In any case, Sure Cart is not for me, so instead of continuing this thread, I will close it now.
Hello,
Thank you for your answer. I understand now that customers need a role for the plugin to reference.
Is there a way at least to prevent the user from getting the site default roles too? That way I could at least grant all sure cart members a permission that does not conflict with the site’s default role.
Unfortunately, the methods you suggested will not work for me. I cannot check the “user” as opposed to the role. I will not be the one checking the roles – I have non-negotiable plugins that I will use (I am not a developer) and all of them assigns rules to all of the roles on the site, NOT the users (there will be too many users). In the settings, it will list all the roles of the site and you have to choose whether or not this user role will have access to some permission or not, yes or no. It is impossible to leave one of them unallocated. For example: in the “messaging others” setting, it will list all the user roles and you have to select “can this user role message others, yes or no”. If I select “no” for subscribers but “yes” for sure cart customers or premium members, there will be a conflict if a user was allocated the default subscriber role as well as the sure cart customer role when making a subscription purchase, and the premium member role.
Also, can we send reminder emails to customers before their free trial ends, not just the end of their subscription?
Thank you
Hello Jarryd.
Sorry for so many questions.
I don’t think my issue is related to Stripe, since I have an actual live and working website that runs on Stripe and Woocommerce, I set that up before myself. Even in test mode, Woocommerce shows the orders and revenue processed by Stripe and the gateway fees etc.
For this test site however, I’ve been doing a lot of testing with PMP and the issue I have is test users signing up but not getting a “subscription”. When a test user signs up, they get the confirmational page as usual that says “$XY amount paid on [date]”. Note it says “Paid”, so I think it means payment was accepted already (if it were in live mode). But when I go to my PMP orders, even though the status says “Paid”, there is nothing in the billing section, nothing in the transaction ID, and when I look at an individual member, there is nothing in their subscription history either. So, they are a member but have not subscribed.
At first I thought this was due to the free trials I was adding to my subscriptions and that there would be a subscription after the trial ends, but I tested it by requiring a sign up fee up front as well as a monthly subscription that does not have a trial, and the result is the same. At the moment, without an active subscription, there is also no way for me to test the reminder emails. In fact, when signing up, the page does not even ask for credit card or payment details whether on live or test mode for Stripe.
This is becoming a quite complicated issue, should I send a support ticket to your team directly on your site instead of here? Perhaps I can put more details there.
Thank you so much.
Forum: Plugins
In reply to: [Simple Membership] Can we limit purchase of free level to once per person?Hello
Thank you for such a fast response on a weekend.
The documentation you provided is helpful, thank you. But for method 2 on that page – is there a way to limit the number of times a person can subscribe to a free trial? I would like to limit it to one per person, and then they can manually sign up for a paid subscription if they want to, rather than having a recurring plan and then people complain about how it automatically renewed and then process refunds.
As for the Stripe fees, what I mean is several other paid membership plugins charge an extra fee to allow us to process subscription payments with Stripe, I was wondering if you also charge an additional fee for us to use Stripe too.
Thank you
Regarding the option to let the users use the subscription rights until it expires – I mean this is a function in the back end that you can purchase as an add-on, it’s called Pro Rata, you can see it here.
- This reply was modified 2 months, 4 weeks ago by stephunique. Reason: I wrote a reply thinking this was for another plugin, I corrected my response to fit this plugin