What I want to do is create a form on my website that Nabble users and non-Nabble users can enter their email address into to subscribe to a mailing list. This is the code I have written so far:
This works fine when I'm logged in as the owner of the mailing list. When I'm not logged in, I get told that I don't have authorisation to add users to the list. I understand that this is because the function on the website is designed for the admins and not for everyone else. My question is, can I modify this form to allow users (Nabble and non-Nabble) to be able to add themselves to my mailing list? Thanks, Todd Power |
I like your idea and initiative. I think the right solution is to create a REST interface that you can access behind the scenes. Otherwise any person would be able to invite users to your forum on your behalf (this isn't good, right?).
So, do you think a REST interface would be better in this case? Or a simple form like that would be enough for you (and you also wouldn't care about people sending invites on your behalf)? Here is one example of REST interface we have: http://n2.nabble.com/API-for-Nabble-2-tp792099p1653228.html |
Hi and thanks for your reply.
I'm unsure of what a REST interface is and how I would apply this to my code (I haven't been doing HTML very long, and I'm basically teaching myself). Applying this to me, can you confirm that the Id would be 15559, the owner is the email address I use to log in, and the action is "add"? I'm unclear on the password and user fields. What is the name of the cookie I'm looking for, or does this change for each user? What would I need to enter for the user field, as this would change depending on what the user enters. I guess I would have to reference the subscribers field in the code, but I'm hoping you can tell me how to do this. This wouldn't be a huge problem for me, although your idea does sound like the right solution. Apologies for having so many questions. |
A REST interface is pretty much a link that you should call from your backend. When your code opens this link, Nabble changes your forum based on the parameters you provide. The idea is that your form will be submitted to your backend (e.g., java, php, whatever you have) and your code will build and open this link to notify Nabble about the changes. That REST interface is not what you want. That one is used to add members to the forum. This is different from adding subscribers. So we would have to build a similar interface for your case, which I think is worth doing. So first please confirm that you would be able to change your backend to process this request and call the Nabble link. If you can't do this (e.g., your hosting service doesn't allow this), then we will have to go with the other solution. |
Hi Hugo,
Unfortunately, I don't think this will be possible. My website is hosted by Weebly and without purchasing my own domain, I have very limited access to the server. What is the other solution? Thanks for all your help. |
We have created a solution for you, but it will be available only after the next release (which should happen in the some days -- probably next Sunday). I will let you know when it is ready and how the form should look like.
|
In reply to this post by Todd_Power
The solution is ready. Here is an example of how your form should look like:
<form method="post" action="http://n3.nabble.com/catalog/ManageSubscribers$Invite.jtp" style="border: 3px solid rgb(207, 38, 45); padding: 2px 4px; width: 300px; background-color: rgb(240, 240, 240);"> <h1 style="font-size: 28px;">Mailing list</h1> <input type="hidden" name="app" value="93800" /> <p style="text-align:center;font-weight:bold">Join my mailing list</p> Your email: <input name="email" style="width:300px"></input> <input type="submit" value="Subscribe Me"/> <p> <b>IMPORTANT</b><br/> Nabble will send an invitation to your email address. Please click the link to confirm your subscription. </p> </form>Please try that and let me know if you need help. |
Hi Hugo,
I just tried this and got this:
|
Please post a link to the page where the form is. The error indicates that the form doesn't have a hidden field called "app" (which is the ID of your application in the Nabble database).
|
Hi Hugo,
http://rosecottage.weebly.com/contact.html What's strange is that although I get the error message, the confirmation email still gets sent. Thanks, Todd |
Thanks for reporting this, Todd. This bug will be fixed by the next release.
|
Hi Hugo,
I've changed around a few things to include a onfocus/onblur and validation Javascript, and this is what I have at the moment. At the moment they get sent to a Nabble page which says: This will confuse a lot of people on my website as the page they are being referred to will be blocked to them (i.e. they will get the Nabble message of Private Forum: Authorized Users Only) and will be scared off by it. What I'd like to do is after clicking the OK button in the alert box, send them back to the homepage of my website (http://rosecottage.weebly.com). Is this possible? Thanks, Todd PS: If this is too difficult, don't worry about it. Thanks for all the help you've given me so far. |
You are lucky because I was working on that code when I saw your message. So I added support for a "nextUrl" parameter that you can add to your form:
<input type="hidden" name="nextUrl" value="http://rosecottage.weebly.com" />This will work only after the next release, but you can add the parameter now because it won't break anything. The next release should happen in a few days. |
Thank you!!
|
Hi Todd, do you still use this subscription solution?
If yes, you will have to change some small details in the HTML form after the next Nabble release. Please let me know so that I can provide more details to you. |
Free forum by Nabble | Edit this page |