Summary: When I add a “data-members-label” field to a form, I expect the member to be assigned the submitted label. Instead, the label is added to the dropdown list of available labels in the Members area of the Ghost dashboard, but the member is not actually assigned the label.
URL: The site is currently private so I cannot provide a URL at this time.
Ghost version: 4.1.2
How was Ghost installed and configured? Hosted version.
What Node version, database, OS & browser are you using? Whatever the hosted version is using.
What errors or information do you see in the console? None.
What steps could someone else take to reproduce the issue you’re having?
Add a form to a frontend template and include a “label” field. Something like: <form data-members-form='subscribe'> <input data-members-label type='checkbox' value='mylabel'> <!-- Or: <input data-members-label type='hidden' value='mylabel'> --> <input type='email' name='email'> <button type='submit'>Subscribe</button> </form>
As a logged-out user (i.e. in an incognito window), click the checkbox and add a valid email address. Submit the form.
Click the link in the activation email you receive at the email address from #2.
Go to the members area of the Ghost dashboard (/ghost/#/members) and select the newly-created member.
Observe the “Labels” field. Expected result: the label “mylabel” should be present. Observed result: no labels are present; the label “mylabel” is, however, available as an option in the dropdown.
What do I need to change to get the label to be correctly assigned to the new member?
I have the exact same bug (label created in the dropdown but not applied to the member created). In weeks, haven’t been able to have this feature to work once. Good to hear a fix is coming soon!
I also notice that if the value of the hidden label is some attribute (like primary_tag) and the value is null (no tags assigned), then when the user clicks to confirm subscription, the Portal says error…I would think this is an unexpected behaviour.
Hi @rishabhgarg, do you happen to know in which version this bugfix might appear? My client has asked me for an update. I haven’t been in the Ghost ecosystem for very long, so I’m still learning about things like your product release schedule.
maybe some of you could advise? For me, the labels also don’t work. I have it in the dropdown of the labels in the members but it’s not giving it the proper label to the member, tried both codes.
Please see my code below, I’m using the form from my theme. Not sure what I’m doing wrong.
<form data-members-form="subscribe" class="c-subscribe-form">
<div class="form-group">
<label for="subscribe-email-footer" class="u-hidden-visually">Your email address</label>
<input data-members-label type="hidden" value="DPC'>
<input type="email" name="email" class="c-subscribe-form__input" id="subscribe-email-footer" placeholder="Your email address" data-members-email="">
<button type="submit" value="Subscribe" class="c-btn c-btn--action c-subscribe-form__btn">Subscribe</button>
</div>
<div class="u-alert u-alert--success u-mt-16">Please check your inbox and click the link to confirm your subscription.</div>
<div class="u-alert u-alert--invalid u-mt-16">Please enter a valid email address!</div>
<div class="u-alert u-alert--error u-mt-16">An error occurred, please try again later.</div>
</form>
Hey @PixelzFairy , which version of Ghost you are running ? The fix for this landed with release of 4.5, can you try again after updating to latest version of Ghost and see if you can still reproduce this behaviour.
@PixelzFairy I am unable to reproduce the issue with the code you pasted, its able to create and assign label correctly. If you still run into any problems I’d suggest you reach out to Ghost Pro support directly