Forums : Bulk Subscribe

Joel Dahlin asked on December 10, 2014 23:15

I have a forum I am using for company announcements. Is there a way to subscribe all my users to this forum without waiting for them to subscribe on their own?

I've found I can do it directly in the database, but wondering if there is a way in the CMS Admin that this can be done?

Correct Answer

Filip Ligač answered on December 22, 2014 14:33

Hi Joel,

I am afraid Virgil is right. There is no built-in feature which would enable you to subscribe all users to a certain forum post. However, you could do it quite simply through Kentico API while looping through all users. Creating a sample forum subscription looks like this:

// Create a new subscription
ForumSubscriptionInfo fsi = new ForumSubscriptionInfo();
fsi.SubscriptionForumID = ForumContext.CurrentForum.ForumID;
fsi.SubscriptionEmail = HTMLHelper.HTMLEncode(txtEmail.Text.Trim());
fsi.SubscriptionGUID = Guid.NewGuid();
fsi.SubscriptionPostID = ForumContext.CurrentSubscribeThread.PostId;
fsi.SubscriptionUserID = MembershipContext.AuthenticatedUser.UserID;

// Subscribe
ForumSubscriptionInfoProvider.Subscribe(fsi, DateTime.Now, true, true);

More API examples can be found in ~/CMSModules/Forums/Controls folder and a complete Kentico API documentation here - Kentico 8.1 API Reference.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Virgil Carroll answered on December 11, 2014 18:08

Joel,

Not that I have ever seen. I would think API is probably the way you would have to go.

Tx, Virgil

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.