Forum Discussion

jonathancrow's avatar
12 years ago

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

  • AdamN's avatar
    AdamN
    Khoros Oracle

    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!

    • erjames5's avatar
      erjames5
      Expert

      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!

    • Inactive User's avatar
      Inactive User

      Is there a component like these for the email subscription from a board page? THanks

      • Inactive User's avatar
        Inactive User

        Nevermind. Found it. Just replaced 'message' or 'thread' with 'board'. Thanks!

    • LainieH's avatar
      LainieH
      Expert

      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 





       

      • matthew_d's avatar
        matthew_d
        Mentor

        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.