So I use the members’ feature to collect subscribers and I want to segment the subscribers by labels. I know I can go into the dashboard and add them one at a time, but I want to customize the subscription form altogether, I want to add 3 little checkboxes under the form that says “click all that apply” so when a user subscribes they can choose what category(s) they want to subscribe too.
The categories on my website are Art, Tech, Business. So I would want 3 checkboxes one for each category/label, so when they subscribe they get the right label/labels.
I hope this makes sense. Could really use some help!
Well, not really. Because my subscription form shows on the bottom of every post. I want my subscribers to be subscribed based on what post they are reading. For example if they are reading a post in my art category, I want them labeled art, when they subscribe, but if they are reading a tech post in my tech category, I want them labeled tech when they subscribe.
Is there a way to apply the labels based on the tag of the post they are reading?
Presuming those are primary tags I imagine you should be able to do something like this <input data-members-label type="hidden" value="{{primary_tag}}" />
I tried that, I have tried adding different codes to different places, and seems like maybe its not working? Maybe I am not saving the files correctly? But I open the post.hbs file add the code click save, and re upload the theme and nothing seems to be working
That does sound like there could be a bug to me but I’m not official ghost staff, just trying to be helpful where I can. If you aren’t already you should probably be developing your theme locally like so: Local Install
It makes it easier to test changes quickly without having to re-upload your theme every time and without affecting your published site.
On the debug side - have you already made the label you’re trying to add on the members panel? You might need to make sure it exists there before it can be applied via the form.
Here is an image of my theme code for the subscription form to always render, what code do I add and where to get the labels applied to subscribers based on primary tag I am guessing?
Ah, that’s not the file you want to add the input to, as it turns out. You’re going to need to find the file called subscribe-form.hbs. Your post file is referencing that (By having the line {{> subscribe-form}}) to show the form, so that’s the file you’re going to need to add the input to. It’ll likely be under a folder called partials.
I want to know if the label you’re trying to add is already in that dropdown. If not, try using the + Add Label button to add it and then test out your subscribe form again.
Mind taking another screenshot of your subscribe-form.hbs with the new input in it for me?
I’m sure you added it fine but something might jump out at me if I can stare at it.
Ah!
I feel a little dumb. Instead of {{primary_tag}} you’ll want to do {{primary_tag.name}}. I totally forgot that just doing primary_tag doesn’t actually get you the right thing. That’s my fault.