h1. Overview {anchor:id=KSref.UserStatistic.Overview}

The Auto-count Active Users component is to calculate the number of active users automatically. A user is considered as the active user only when he/she adds a topic/post in the Forum and his/her last post date matches the predefined interval time.

For example, if one user does not have any new posts after 15 days, he/she is not considered as an active user.

When the Job Scheduler runs, it will get values returned from the Auto-count Active Users plug-in component to identify the number of active users. This value is updated to Active Members information when the user views Forum statistics.

h1. Configuration {anchor:id=KSref.UserStatistic.Configuration}

The properties of Auto-count Active Users plug-in is configured in the _{noformat}war:webapp/WEB-INF/ks-extension/ks/forum/statistics-configuration.xml{noformat}_ file.

In details, at runtime of Job Scheduler, the Auto-count Active Users plug-in component is called. Then, the _statistics-configuration.xml_ file is executed. The component-plugin named _RecountActiveUserJob_ will refer to _org.exoplatform.forum.service.conf.RecountActiveUserPeriodJob_ to calculate the number of active users.

{code:xml}
<component-plugin>
  <name>RecountActiveUserJob</name>
  <set-method>addPeriodJob</set-method>
  <type>org.exoplatform.forum.service.conf.RecountActiveUserPeriodJob</type>
  <description>add a RecountActiveUser job to the JobSchedulerService</description>
  <init-params>
    <properties-param>
      <name>job.info</name>
      <description>save the monitor data  periodically</description>
      <property name="jobName" value="RecountActiveUserJob"/>
      <property name="groupName" value="KnowlegedSuite"/>
      <property name="job" value="org.exoplatform.forum.service.conf.RecountActiveUserJob"/>
      <property name="repeatCount" value="0"/>
      <property name="period" value="7200000"/> <!-- 2 hours-->    
      <property name="startTime" value="+0"/>
      <property name="endTime" value=""/>               
    </properties-param>
    <properties-param>
      <name>RecountActiveUser.info</name>
      <description></description>
      <property name="lastPost" value="15"/> <!-- users are active if have last posts in 15 day -->
    </properties-param>
  </init-params>
</component-plugin>
{code}

* In which, 
|| Name || Method || Type || Description ||
| *RecountActiveUserJob* | addPeriodJob | org.exoplatform.forum. service.conf. RecountActiveUserPeriodJob | Add a RecountActiveUser job to the JobSchedulerService. |

* The properties for Auto-count Active Members plug-in are defined in the ~~property~~ tag as below:

{code:xml}
...
<property name="jobName" value="RecountActiveUserJob"/>
<property name="groupName" value="KnowlegedSuite"/>
<property name="job" value="org.exoplatform.forum.service.conf.RecountActiveUserJob"/>
<property name="repeatCount" value="0"/>
<property name="period" value="7200000"/>   
<property name="startTime" value="+0"/>
<property name="endTime" value=""/>     
...
<property name="lastPost" value="15"/> 
...
{code}

In which:

|| Property name || Possible value || Default value || Description ||
| *jobname* | {{String}} | {{RecountActiveUserJob}} | The name of job which will be executed. |
| *groupname* |{{String}} | {{KnowlegedSuite}} | The name of application which will be executed. |
| *job* | {{Class path}} | org.exoplatform.forum. service.conf. RecountActiveUserJob | The reference function of job which will be executed. |
| *repeatCount* | {{Long}} | 0 | The number of times the job is repeated. If *repeatCount* is set to *0*, RecountActiveUserJob is called at runtime only without repeating. If the number is set to *2* or *3*, RecountActiveUserJob  will be called two or three times. |
| *period* | {{Long}} | 7200000 (millisecond) (equal to two hours) | The interval time to execute the job. |
| *starttime* | {{Integer}} | 0 | The start time when the function executes. The _starttime_ is +0, meaning that the time to start executing _RecountActiveUserJob_  is the runtime. |
| *endtime* | {{Integer}} | null | The end time when the function stops executing. The _endtime_ is blank, meaning that there is no limitation for the end time for _RecountActiveUserJob_. |

With start and end time, you can give a specific date in the format: yyyy-mm-dd HH:mm:ss.sss to define the start and end time for _RecountActiveUserJob_.
 
The information of active time is also defined:

|| Property name || Possible value || Default value || Description ||
| *lastPost* | {{Integer}} | 15 | The number of days that the user has added the last post. _lastPost_ is 15, meaning that all users, who have any new posts within 15 days as from their last post date, are active members. |

By default, the default properties can only be changed by editing its values in the _statistics-configuration.xml_ file.

At runtime, the new changes in the _statistics-configuration.xml_ file will be executed and updated. The Auto-count Active Users plug-in will be executed, depending on its properties.