jonathancrow
12 years agoAdvisor
Subscribe Button
I want to highlight the option to subscribe to a post, thread, or board with a button (instead of having it hidden in the options menu).
Does anyone already have code to do that?
Thanks,
Jonathan
I want to highlight the option to subscribe to a post, thread, or board with a button (instead of having it hidden in the options menu).
Does anyone already have code to do that?
Thanks,
Jonathan
Thanks for the help. I guess I should have been a bit more clear here. I am looking for a way to put it in post and not in the menu bar. When you access the drop down to subscribe to this post the class and links look like:
<a class="lia-link-navigation addMessageUserEmailSubscription lia-component-subscriptions-action-add-message-user-email" rel="nofollow" id="addMessageUserEmailSubscription_0" href="/t5/forums/forumtopicpage.addmessageuseremailsubscription/message-uid/211261?t:ac=board-id/studio/thread-id/3002/page/2&t:cp=subscriptions/contributions/messageactions&ticket=I_M1L7OnU4GP_52367">Subscribe</a>
If I were to create a button in the thread itself with this code, it would only work for me and look something like this:
This is something that wouldn't go into the CSS to change all of the board styles, but instead link to the drop down menu. Is this possible to just link to the:
lia-link-navigation addMessageUserEmailSubscription lia-component-subscriptions-action-add-message-user-email
Hi matthew_d, I apologize for the delay in responding! We're looking into this and will post later today. Thanks!
I believe the component id for the component that subscribes the current user to a message is "subscriptions.action.add-message-user-email", so you could try adding that inside a custom component using the @component directive:
<@component id="subscriptions.action.add-message-user-email" />
It needs to be in the context of the message you want the user to subscribe to, so you would need to add it to a component that you've placed inside the appropariate "message quilt" (if this is for a forum board, it needs to be in a component that is placed inside the ForumMessage quilt, if it's for a blog board it needs to be in a component that is placed inside the BlogMessage quilt, etc.). If you add it there, you will probably also need to add some CSS to style it to look like a button instead of a link in the post options menu drop-down.
I'm not sure if anyone has tried doing this before, so ymmv.
The other options would be to roll your own subscription component using the REST API call for subscibing the current user to a given message.
If you are trying to add a link/button to subscribe the current user to an entire thread, that uses the "subscriptions.action.add-thread-user-email" component (use <@component id="subscriptions.action.add-thread-user-email" />) and you'll need to place the @component directive in a custom component that is in a "thread page quilt" (ForumTopicPage, BlogArticlePage, IdeaPage, etc.) or else roll your own logic to subscribe the current user to the thread, using the REST API call for subscribing the current user to a given thread.
If you are trying to add the link/button to subscribe the current user to a board, that uses the "subscriptions.action.remove-board-user-email" component(use <@component id="subscriptions.action.remove-board-user-email" />) and you'd need to place the @component directive in a custom compoennt that is in a "board page quilt" (ForumPage, BlogPage, IdeaExchangePage, etc.) or else roll your own logic to subscribe the current user to the board, using the REST API call for subscribing the current user to a given board.
I hope that helps!
-Doug
Thank you so much for posting! We've been desperately needing this as most users cannot find the subscription button under "page options." I'm not an engineer, so I'm not able to use the Lithium SDK with any amount of confidence. Greatly appreciated!
I've been following this thread and haven't yet got this to work.
Same issue / question - we want to make it easy for a user to subscribe to the message or perhaps the thread.
I've explored using the API... but consistently get a 501 errorr code when I use the POST method.
For example:
<form action="https://community.xxx.com/restapi/vc/boards/id/tips_and_tricks /subscriptions/users/self/add/email" method="post"><input type="submit"> <!-- Press this button to submit form --></form>
<response status="error">
<error code="501">
<message>
Unknown path element at node 'node_subscription_context.users.self.add'.
</message>
</error>
</response>
I get the same result for:
<form action="https://community.xxx.com/restapi/vc/threads/id/1615100/subscriptions/users/self/add/email" method="post"><input type="submit"> <!-- Press this button to submit form --></form>
Any ideas or feedback?
Thanks
John
Thanks...
If there's an OOB component, then I'll use it.
However, when I create a new custom component in studio ...
<div class="board-subscribe">
<@component id="subscriptions.action.add-message-user-email"/>
</div>
It returns an error.
RenderQueueException:Render queue error in SetupRender[subscriptions/contributions/MessageActions:addmessageuseremailsubscription]: Failure reading parameter 'isVisible' of component subscriptions/contributions/MessageActions:addmessageuseremailsubscription$isvisible: No object of type lithium.web2.data.entity.PrimaryRenderContextEntity is available from the Environment.
I must be missing something.
Thoughts? Is this component documented?
Thanks for the help
John
hi jjeremiah
try the following instead: <@component id="subscriptions.action.add-board-user-email"/>
You can get more details in this discussion: https://community.lithium.com/t5/Developer-Discussion/Subscribe-Button/m-p/84472