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
Hi Jonathan,
Depending on your requirements, you may be able to leverage the standard components for your purposes. The components just display as links, but if you wanted to you could create a custom component, insert the component(s) using the <@component> FreeMarker macro, wrap the component with your own HTML and style as needed.
Here are the subscription-related components for a thread:
<component id="subscriptions.action.remove-thread-user-float" /> <component id="subscriptions.action.add-thread-user-float" /> <component id="subscriptions.action.remove-thread-user-bookmark" /> <component id="subscriptions.action.add-thread-user-bookmark" /> <component id="subscriptions.action.remove-thread-user-email" /> <component id="subscriptions.action.add-thread-user-email" />
and for a message:
<component id="subscriptions.action.remove-message-user-float" /> <component id="subscriptions.action.add-message-user-float" /> <component id="subscriptions.action.remove-message-user-bookmark" /> <component id="subscriptions.action.add-message-user-bookmark" /> <component id="subscriptions.action.remove-message-user-email" /> <component id="subscriptions.action.add-message-user-email" />
You'll likely be interested in the "email" ones, but I provided the others just in case. You'll want to make sure you only use these components on pages where they're going to have the appropriate thread/message context (ie. a ForumMessage page)
Alternately, you could use the REST API to add/remove the subscriptions, but that's probably going to be quite a bit more complex. Let me know if you'd prefer to go down that route, and I can provide some additional details to get you started.
I hope this helps!
I would like to add a custom component on our main community page so that users can bookmark content that they find interesting using a rest api. Is there a rest call that allows me to place a bookmark on the page without refreshing or leaving the current page? In other words, I want the user to be able to bookmark multiple messages on the same page. The above example allows the user to bookmark an article while you are currently on it. Thanks!
Is there a component like these for the email subscription from a board page? THanks
Nevermind. Found it. Just replaced 'message' or 'thread' with 'board'. Thanks!
AdamN this was extremely helpful. I'm 1/2 way there - I created the custom component, added the OOTB component code, wrapped a little HTML around it and even added a couple of CSS styles. cjdinger refined it.. but we're missing one thing.
We want to add the Subsribe button for a board within the
"lia-menu-bar lia-menu-bar-top lia-component-menu-bar" class (vs. adding the button using a fixed position in CSS).
Is this possible?
Thank you, Lainie
Bump this post. LainieH did you ever find the answer to this? AdamN could you provide some additional support here? I have the same question.
Hey Lainie,
We have a way to place items in the menu bar, but it's in an XML file that we don't expose a way to edit through Studio, so someone in our Professional Services group would need to add this for you. We hope to make it self service at some point in the future. The only way I can think of to do it without Services would be to insert it into the menu bar using Javascript, although that could cause a slight delay before the subscription buttons show up.
-Doug
Not to disagree with Doug, but I would suggest a differenty way. First, you can add to the menu but not the menu bar. Adding subscribe to the menu is unnecessary as it is already there. The menu bar is not editable by any means. Second, here is how I would acheive what you are looking for.
1) Add your new component directly above the menbar component. In this example, my custom component is called "custom-add-to-my-places"
2) Add css to float the custom component and the menu bar to the left. You may need to adjust the width of menu bar:
.lia-component-custom-add-to-my-places { float: left; } .lia-menu-bar-top { float: left; width: 97%; }
3) You now have the look of the two items living in the same line. In my case, I styled the subscription as a "favorites" heart to acheive an all icon look:
Ah yes. Sorry, I didn't read the thread closely enough and was confusing the menu bar with the drop-down menu. My mistake. Thanks for weighing in Kaela!