I need a way to add a subription to a board for many users at once
- 11 years ago
I would suggest a customization like this:
- A user goes to the private category/board.
- On entering the area, we check to see if the user is already subscribed
- If not, subscribe them and set an info message saying something like "You have been automatically subscribed to this area"
- If so, do nothing [flag is set or subscription exists]
This way you are making the subscription call as the user themselves. Beyond this, you may want to add a flag on the user saying they have been auto-subscribed the first time. If the user goes in later and removes the subscription, we won't subscribe them again.
- 11 years ago
No problem. I was thinking of something you (or your other dev team) would do in Studio. You would need to create a new component and place it on the private category and/or board pages. You can use freemarker to get the user's current subscriptions for this category: http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?leaf-id=Category.subscriptions#Category.subscriptions.users.self.subscription_type.subscription_target_type
If there is a subscription, move on
If not you can set one with this call: http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?leaf-id=Category.subscriptions#Category.subscriptions.users.self.subscription_type.subscription_target_type
Let's say you are on a category page, you can set a category subscription in freemarker like this
${rest("/categories/id/"+coreNode.id+"/subscriptions/users/self/add?subscription.type=email")}
I would also suggest requesting a new user profile field saying this user has been auto subscribed. In that case you would also set that at the same time as adding the subscription:
${rest("/users/id/"+user.id+"/settings/name/[name] /set?value=[thing to set] ")}
This way if the user goes back into managing their subscriptions and removes the auto-subscription you won't subscribe them a second time. Now if we go back to the first if statement it would look something like this:
<#assign rest("/users/id/"+user.id+"/settings/name/[name]").value />
<#if previousSubscription == "false">
<#-- add the sub -->
</#if>
This is just an example, in reality I would want that flag to be more descriptive (keeps a list of categories a user has been subscribed to in case there is more than one). You would also need to pull in the subscription lists and loop through to test which ones exist.
If this is a bit too much, you can also talk to Professional Services about having it built on our side.