留言板
Message Boards Thread - View Count Problem
Subhasis Roy,修改在10 年前。
Message Boards Thread - View Count Problem
Expert 帖子: 275 加入日期: 12-1-20 最近的帖子
Hi All,
In the message board portlet number of view to any particular thread is showing as 0.
I checked the MBThread table in the database and found that viewCount column is 0 for all the threads.
Can any one please explain this.
In the message board portlet number of view to any particular thread is showing as 0.
I checked the MBThread table in the database and found that viewCount column is 0 for all the threads.
Can any one please explain this.
Harish Kumar,修改在10 年前。
RE: Message Boards Thread - View Count Problem
Expert 帖子: 483 加入日期: 10-7-31 最近的帖子
Looks like some local issue as functionality works just fine. Every time you click on thread, view count got incremented by 1.
Subhasis Roy,修改在10 年前。
RE: Message Boards Thread - View Count Problem
Expert 帖子: 275 加入日期: 12-1-20 最近的帖子Harish Kumar:
Looks like some local issue as functionality works just fine. Every time you click on thread, view count got incremented by 1.
Thanks Harish.
Can you please tell me the class which is responsible for update the count in the MBThread table.
Ramendra Singh Shekhawat,修改在10 年前。
RE: Message Boards Thread - View Count Problem
New Member 帖子: 9 加入日期: 10-9-11 最近的帖子
You can find this in MBThreadLocalServiceImpl class.
Harish Kumar,修改在10 年前。
RE: Message Boards Thread - View Count Problem
Expert 帖子: 483 加入日期: 10-7-31 最近的帖子
Hi Subhasis,
As Ramendra mentioned
public MBThread incrementViewCounter(long threadId, int increment)
throws PortalException, SystemException {
from MBThreadLocalServiceImpl class get called to increment the view count.
As Ramendra mentioned
public MBThread incrementViewCounter(long threadId, int increment)
throws PortalException, SystemException {
from MBThreadLocalServiceImpl class get called to increment the view count.
Subhasis Roy,修改在10 年前。
RE: Message Boards Thread - View Count Problem
Expert 帖子: 275 加入日期: 12-1-20 最近的帖子
Thanks. But I am using Liferay 6.0.6 and in the "MBThreadServiceImpl" class I have not found any method for increment the view count
Subhasis Roy,修改在10 年前。
RE: Message Boards Thread - View Count Problem
Expert 帖子: 275 加入日期: 12-1-20 最近的帖子
Got it..!!!
For liferay 6.0 its the following method
public com.liferay.portlet.messageboards.model.MBThread updateThread(
long threadId, int viewCount)
in the MBThreadLocalService.java / MBThreadLocalServiceImpl.java
Fixed the issue by adding the folloing code in my portlet
//code start
MBMessage existingThreadMsg = MBMessageLocalServiceUtil.getMBMessage(messageId);
MBThread threadT = existingThreadMsg.getThread();
int viewTCount = (threadT.getViewCount() + 1);
MBThreadLocalServiceUtil.updateThread(threadT.getThreadId(), viewTCount);
//code end
For liferay 6.0 its the following method
public com.liferay.portlet.messageboards.model.MBThread updateThread(
long threadId, int viewCount)
in the MBThreadLocalService.java / MBThreadLocalServiceImpl.java
Fixed the issue by adding the folloing code in my portlet
//code start
MBMessage existingThreadMsg = MBMessageLocalServiceUtil.getMBMessage(messageId);
MBThread threadT = existingThreadMsg.getThread();
int viewTCount = (threadT.getViewCount() + 1);
MBThreadLocalServiceUtil.updateThread(threadT.getThreadId(), viewTCount);
//code end