Help:Extension:SocialProfile/User stats

User statistics in SocialProfile mainly deal with user levels, which is a somewhat "gamified" way to keep your users engaged and contributing to the wiki. In practise this means that through the user levels system, users can be awarded a set amount of points for performing certain actions on-wiki.

A user's points and their corresponding "rank" are shown on their structured social user profile page as well as on various ranking pages like Special:TopUsers, which shows the users who have the most points on the wiki. The user rank and points shown on social profiles links to a help page; the help page name is controlled by the interface message [[MediaWiki:User-profile-userlevels-link]], but this page is always assumed to exist in the help namespace. Disabling this link is currently not possible.

Additionally the rank and points may be shown in other extensions/locations, like comments on blog pages and user box pages as well as elsewhere, for example.

Configuring user levels

edit

A wiki system administrator needs to define the value of $wgUserLevels in the wiki's LocalSettings.php file. The variable is an array of 'Level name' => required points mappings. For example:

$wgUserLevels = [
	'Recruit' => 0,
	'Apprentice' => 1200,
	'Private' => 1750,
	'Corporal' => 2500,
	'Sergeant' => 5000,
	'Gunnery Sergeant' => 10000,
	'Lieutenant' => 20000,
	'Captain' => 35000,
	'Major' => 50000,
	'Lieutenant Commander' => 75000,
	'Commander' => 100000,
	'Colonel' => 150000,
	'Brigadier' => 250000,
	'Brigadier General' => 350000,
	'Major General' => 500000,
	'Lieutenant General' => 650000,
	'General' => 800000,
	'General of the Army' => 1000000,
];

To determine which namespaces earn the user social points, set the $wgNamespacesForEditPoints variable to an array of one or more namespaces; usually at least the main namespace is what most sites will want to include, but it's possible a site has other namespaces they also want to include in the calculations.

The $wgUserStatsPointsValues variable also needs to be properly defined (see below) to hand out points automatically for actions.

Supported actions for which points can be awarded

edit

The key after the human-readable statistic name refers to the value for $wgUserStatsPointsValues, so to give out five (5) points for sending out a gift to another user, a system administrator would set $wgUserStatsPointsValues['gift_sent'] = 5; in the wiki's LocalSettings.php file.

Handing out points for edits made before SocialProfile was installed

edit

To give users points for all the edits they made before the SocialProfile extension was installed, someone with the updatepoints user right should visit the Special:UpdateEditCounts page. There's also a maintenance script that will perform the update from the command line: UserStats/maintenance/updateUserStats.php.

Weekly and monthly winners

edit

It's possible to hand out a certain amount of points to users who have the most points in a week or in a month. However, this process cannot be fully automated just yet (see T212174) and it requires some manual interaction from a privileged user.

Assuming $wgUserStatsPointValues['points_winner_weekly'] and/or $wgUserStatsPointValues['points_winner_monthly'] are properly set in the wiki's LocalSettings.php file, someone with the generatetopusersreport user right needs to visit the Special:GenerateTopUsersReport page.

Visiting this page allows the privileged user to generate the weekly or monthly point report; it will be a page in the project namespaces and the page name is controlled by the interface messages [[MediaWiki:User-stats-report-weekly-page-title]] and [[MediaWiki:User-stats-report-monthly-page-title]]. The report will list a certain amount of users who've gained the most points in the period specified, and the user ranking #1 will be marked as the "winner" and awarded the amount of points specified in $wgUserStatsPointValues['points_winner_weekly'] or $wgUserStatsPointValues['points_winner_monthly'].

edit