UnSubscribe the user from the comment
Whenever we write comment to the post(Blog or webcontent etc..) , user will automatically subscribe to the comments and also will be receving the email when ever any user update or add the comment. If user want to subscribe manually, it is timetaking to check each and every post. so here the following code which helps to unsubscribe the user from the post. Here we are unsubscribing the "Admin" user posts of JournalArticle. String screenName = "Admin"; String className = JournalArticle.class.getName(); User user = null; ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); try { user = UserLocalServiceUtil.getUserByScreenName(themeDisplay.getCompanyId(), screenName); } catch (PortalException e) { e.printStackTrace(); } catch (SystemException e) { e.printStackTrace(); } if(user!=null) { List<subscription> subscriptionList = null; try { ...