What are the key differences in platform access between free and registered users? Answered
Desperately need some help as I'm planning to launch with MS π«‘
I'm trying to prevent free-users from generating more than 10 prompts (form submissions). Currently I have this script in place from the AI free template.
<script> document.addEventListener("DOMContentLoaded", () => { // Wait for Memberstack to be fully loaded before running your code const intervalId = setInterval(async () => { if (window.$memberstackDom) { clearInterval(intervalId); const memberstack = window.$memberstackDom; console.log("Memberstack loaded!"); try { const member = await memberstack.getMemberJSON(); console.log("Member data:", member); const count = member.data.formSubmissions.count; console.log("formSubmissions count:", count); const memData = JSON.parse(localStorage.getItem("_ms-mem")); console.log("_ms-mem data:", memData); const hasPlanConnections = memData && memData.planConnections && memData.planConnections.length > 0; console.log("Has plan connections:", hasPlanConnections); if (count >= 10 && !hasPlanConnections) { console.log("Redirecting to /app/upgrade..."); window.location.href = "/app/upgrade"; } else { console.log("No need to upgrade."); } } catch (error) { console.error(error); } } }, 100); }); </script>
How can I modify this script so that paid users can have unlimited submissions, and free-plan users can only have 10 submissions? After 10 submissions I want them to get redirected to the /app/upgrade page if they click on the submit button for the 11th time.
I've been trying this for a good hour with the help of the friendly Memberstack AI chatbot with no luck π
Comments
18 comments
Hey Jeroen!
Is the problem that its not redirecting users? As in, on the page. If you have over 10 and you refresh, will it redirect?
Hey! The problem is that now I think it only checks for any plan connection, but I want it only applied for 'free-users' and paid users should not be restricted.
I would recommend having the AI chatbot have it check based on plan ID rather than having any plan connections - that way it will be specific with that plan!
Just find the plan ID for your paid plan and feed it to Rey π
Hi Jeroen Kwaad
Here's the modified code, please keep in mind you'd be working with the Plan IDs, not Price IDs:
Thank you so much! π
Hey Julian Galluzzo, thanks for the Loom you made to me! β€οΈ ! However, I still have some doubts, what I have is basically a free product with 500 items let's say.
I'm building a free login wall basically.
What I did initially, was to have 2 CMS Collections duplicated, one of them for "members" and the other one for "!members!". The "!members" collection, had a limit 10 in the CMS Collection List settings. That worked, but since I'm duplicating the same CMS Collection in thye same page, there are some issues with Finsweet filtering and loading items, it's filtering twice basically, because technically there are 2 duplicated collections. So I needed a better way to gate content to non-logged in users, and allow the full experience for log-in, users.
Hey Jordi Espinosa, are you using two instances of finsweet filter for the two CMS collections and still facing issues?
I've got the filters + the CMS collection. What I want to do know is just to limit this collection you see at the bottom at 15 items for free users.
Once you register, then you see all of them.
Yes, I understand. Since you are having duplicated CMS collections and you noticed finsweet is not working accurately and the duplication is interfering, I wanted to know if you tried having two separate instances of filters for this use-case. i.e. one for the free user collection list and one for the collection list visible to registered member. As per the documentation, you can have multiple instances of filters and collection lists on the same page provided you have unique filter element setup for each collection. So maybe you could check if having a filter setup as shared in the guide, solves your issue of conflicting experience in the collections.
Hmmm I didn't duplicate the filters. Maybe I should. I was asking if there's a better way of achieving this.
Duplicating the CMS for "members" and "!members" and limiting the items in one of the collections lists, is the best way to do it right?
Yeah I was thinking of some ways to do that within one collection list, honestly it would have been easier to implement just via attributes if the use-case was for free plan user / paid plan user or any such combination where the items shown are unique to each set of option but in this case, we do want to show the 15 to both the logged out and logged in members, so that gets tricky.
While custom code might have been an option, but when we use finsweet, it is better to keep interference as minimum as possible since we might face the risk of conflicting or messing the way items populate. Hence I suggested an alternate workaround which is possible with the current setup to test.
Hey Jordi Espinosa!! Just got to this - is the 2 filters solution working? π
Yes I understand, did you get a chance to implement two filter approach? Any luck with that?
I tried, but it's a big mess....
Hmm, are the 15 items that you want to show to the non-registered user as well always gonna be the same or are they gonna be dynamic? i.e. some special approach like recent 15 items are shown to everyone rest is shown to registered users
The cms remains the same, I just want to show the first 15 items to the free users and unlimited items to paid users or registered users.
I was thinking another solution could be that you have these 15 items duplicated in the CMS and assign the members or !members attribute for each item instead of the whole CMS, that could solve this if the 15 items are gonna be consistent. But I am not sure if that would be an ideal approach for your use-case.
Please sign in to leave a comment.