Is there a way to set up subscription buttons on Custom Pages?

I have a few groups creating Custom Pages to achieve the look and feel that they want without creating a new group for just a forum and Wiki. Is there a way to create subscription buttons for the Wikis and Forums on a custom page? I know the "button" in the widget appears within the application, but it doesn't look like there are these options on a custom page. 

Thanks!

  •   That's not an option out of the box. You could (likely) create an automation to perform this from a custom button or the Navigation widget. Probably something like https://community.telligent.com/community/12/w/api-documentation/71089/set-application-subscription-rest-endpoint, but I'm not sure. This is something I've wanted to create in my community but haven't gotten to yet. 

    You could also use  Subscribe Users To Group Applications and have the members join the group, and auto-subscribe to the necessary applications if the page(s) are within the group(s). You might also be able to use some of that code as a starting point to build your custom automation. 

    I hope this helps!

  • You would need to create a custom widget, the tricky bit here is knowing what to subscribe to as you may not be it the forum/wiki context if you are creating custom pages

    so it would need a configuration property where you can set the forum. wiki etc 

    Then most of the code could be copied from the stock group links widget using some custom code to check for the subscription etc 

    So for example if you knew the forum id this would expose the current subscription state

    #set ($dataContextId = $forum.Id)
    #set ($dataContext = 'forum')
    
    <form>
    	<fieldset>
    	<ul class="field-list">
    		<li class="field-item">
    			#set($subscription = false)
    			#if($dataContext == "forum")
    				## check for existing subs
    				#set ($subs = false)
    				#set ($subs = $core_v2_emailDigest.List(0, 100))
    				#foreach($sub in $subs)
    					#if($sub.Context == $dataContext && $sub.ContextId == $dataContextId)
    						#set ($subscription = $sub)
    						#break
    					#end
    				#end
    			#end
    			<select data-context="$core_v2_encoding.HtmlAttributeEncode($dataContext)" data-contextid="${dataContextId}" data-subscriptionid="#if($subscription) $subscription.Id#else -1#end" class="email-digest ui-select">
    				<option value="0" #if(!$subscription || ($subscription.FrequencyInDays != 1 && $subscription.FrequencyIndays != 7)) selected#end>$core_v2_language.GetResource('NotSubscribed')</option>
    				<option value="1" #if($subscription && $subscription.FrequencyInDays == 1) selected#end>$core_v2_language.GetResource('Daily')</option>
    				<option value="7" #if($subscription && $subscription.FrequencyInDays == 7) selected#end>$core_v2_language.GetResource('Weekly')</option>
    			</select>
    		</li>
    	</ul>
    	</fieldset>
    </form>
    	
    ## then reuse the code from the core widget to update etc (emaildigestupdate.vm) 

  • Yep, was going to suggest the same. That's the benefit of using the application's own pages, since they bring along automatic context about the current content or application. 

  • One of the use cases I've wanted to set up with something like this (someday) is to have a landing page for a group (new members, partners, customers with specific products, etc) and give them a list to say "Here are your recommended things to subscribe to around our community" to let them check them all of on one page. Definitely saving this code for when "someday" comes, thanks  

  • Thank you! 

    Please forgive me, I'm not a coder....I've created the new widget in the Widget Studio, but how do I identify which forum I want to apply this to? Do I have to do a new widget for every forum that we want this option for, or is there a way to select the forum in the group when adding the widget? 

    If I have to create new widgets for each forum that I want to use this for, where do I put the forum ID? Before, After, or replace $forum.id?

  • Hey Rachel

    Looking at my example above that is for "email digests" and would apply to groups, sorry for the confusion

    For forums I would start again by looking at the "forums - link" widget as this is what is used to add subscriptions when you are in the context of the forum so has all the subscribing code you need

    In this case and many others widget studio can also be your friend as there is more than likely a widget which does some of what you want, in the footer section you can use "find in widgets"

    so back to your question, how do I get the forum id

    you are interested in a configuration property for forums, this in v12 is "core_v2_forumLookup" see Property Templates for lots more

    if you use find in widgets for "core_v2_forumLookup" 

    you will see widgets which already have this type of configuration, I'd use search result list as it is asking for a single forum id and not allowing groups

     e.g.

    <property id="defaultAskForum" labelResourceName="Core_SearchResults_DefaultForum_Name" descriptionResourceName="Core_SearchResults_DefaultForum_Description" dataType="Custom" template="core_v2_forumLookup" enableGroupSelection="false" maxForumSelections="1" />

    you will need to add your resources for the title name and description

    then if you look in the widget for the property id, in this case "defaultAskForum" you should be able to see how its used to get the id, again "find in widgets" can help you find it 

    in this example its 

    #set ($defaultAskForumId = false)
    #set ($defaultAskForum = $core_v2_page.ParseQueryString($core_v2_widget.GetStringValue('defaultAskForum', '')))
    #if ($defaultAskForum.Value('Forum'))
    	#set ($defaultAskForumId = $core_v2_utility.ParseInt($defaultAskForum.Value('Forum')))
    #end
    
    #set ($currentForum = false)
    #set ($currentForum = $core_v2_forum.Get($defaultAskForumId))



    Hope this help, but proceed entirely at your own risk