private void Page_Load(object sender, System.EventArgs e) { Title = SiteUtils.FormatPageTitle(siteSettings, ForumResources.UnSubscribeLink); AddClassToBody("forumthreadunsubscribe"); //if (!Request.IsAuthenticated) //{ // lblUnsubscribe.Text = ResourceHelper.GetMessageTemplate("AccessDeniedMessage.config"); // return; //} threadSubGuid = WebUtils.ParseGuidFromQueryString("ts", threadSubGuid); if (threadSubGuid != Guid.Empty) { ForumThread.Unsubscribe(threadSubGuid); lblUnsubscribe.Text = ForumResources.ForumThreadUnsubscribeCompleted; return; } int threadID = WebUtils.ParseInt32FromQueryString("threadid", -1); if (threadID > -1) { UnsubscribeUser(threadID); } }
private void UnsubscribeUser(int threadId) { SiteUser siteUser = SiteUtils.GetCurrentSiteUser(); if (siteUser == null) { return; } if (!ForumThread.Unsubscribe(threadId, siteUser.UserId)) { log.ErrorFormat("ForumThread.UnSubscribe({0}, {1}) failed", threadId, siteUser.UserId); lblUnsubscribe.Text = ForumResources.ForumThreadUnsubscribeFailed; return; } lblUnsubscribe.Text = ForumResources.ForumThreadUnsubscribeCompleted; }