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!

Parents
  • 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) 

  • 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

Reply
  • 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

Children
No Data