Extension:SocialProfile/Technical documentation

The SocialProfile extension integrates multiple social functionalities into MediaWiki software.

For installation instructions, see Extension:SocialProfile.

Configure edit

Some features won't work without additional changes, but if chosen by the site admin, may be left out.

User profile edit

$wgUserProfileDisplay is an associative array that controls which sections are displayed on the user profile. The value of each item should be true to display that section, or false to hide it. Note that the display of those sections in the user profile is independent of whether users can use those features.

Key User profile section
personal Personal information
custom Custom information
interests User interests
friends Friends
foes Foes
gifts Gifts
awards Awards
activity Activity
board Board
userboxes Userboxes
stats Stats
games Games

If $wgUserPageChoice is set to false (it defaults to true), users will not be able to switch their own user page to be a wiki page, and only the social user profile will be enabled.

Relationships edit

To enable friends/foes to display on the user page, the following additions need to be made to LocalSettings.php:

The following settings should be placed directly under the require_once line:

$wgUserProfileDisplay['friends'] = true;
$wgUserProfileDisplay['foes'] = true;

$wgFriendingEnabled decides whether to enable friending or not. At the moment, however, it isn't really effective - don't rely on it.

Board edit

To enable the Board to display on the user page, allowing users to view messages posted, the following settings need to be added:

$wgUserBoard = true;
$wgUserProfileDisplay['board'] = true;

User-specific statistics edit

To enable per-user statistics that show up on the profile pages, add the following into your wiki's settings:

$wgUserProfileDisplay['stats'] = true;

Points system edit

User Levels show on the users' profile pages and on various other places across the wiki. This feature is available from SocialProfile version 1.1 onwards (rev:37590).

Note that this feature must be correctly configured, or it can interfere with other features, such as avatar upload and messaging. See the discussion on the talk page.

To enable user levels, add something like below into your wiki's settings:

require_once( "$IP/extensions/SocialProfile/UserStats/EditCount.php" ); // Necessary edit counter
// The actual user level definitions -- key is simple: 'Level name' => points needed
$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,

You may also want to configure the actions for which points are being awarded. The default settings are:

$wgUserStatsPointValues['edit'] = 50; // Points awarded on a mainspace edit
$wgUserStatsPointValues['vote'] = 0; // Points awarded for voting for an article
$wgUserStatsPointValues['comment'] = 0; // Points awarded for leaving a comment
$wgUserStatsPointValues['comment_plus'] = 0; // Points awarded if your comment gets a thumbs up
$wgUserStatsPointValues['comment_ignored'] = 0; // Points awarded if another user ignores your comments
$wgUserStatsPointValues['opinions_created'] = 0; // Points awarded for writing a blog article
$wgUserStatsPointValues['opinions_pub'] = 0; // Points awarded for having that article hit the "Blogs" page
$wgUserStatsPointValues['referral_complete'] = 0; // Points awarded for recruiting a new user
$wgUserStatsPointValues['friend'] = 0; // Points awarded for adding a friend
$wgUserStatsPointValues['foe'] = 0; // Points awarded for adding a foe
$wgUserStatsPointValues['gift_rec'] = 0; // Points awarded for receiving a gift
$wgUserStatsPointValues['gift_sent'] = 0; // Points awarded for giving a gift
$wgUserStatsPointValues['points_winner_weekly'] = 0; // Points awarded for having the most points for a week
$wgUserStatsPointValues['points_winner_monthly'] = 0; // Points awarded for having the most points for a month
$wgUserStatsPointValues['user_image'] = 1000; // Points awarded for adding your first avatar
$wgUserStatsPointValues['poll_vote'] = 0; // Points awarded for taking a poll
$wgUserStatsPointValues['quiz_points'] = 0; // Points awarded for answering a quiz question
$wgUserStatsPointValues['quiz_created'] = 0; // Points awarded for creating a quiz question
$wgNamespacesForEditPoints = [ 0 ]; // Array of namespaces that can earn you points. Use numerical keys. Default is 0 -- only main namespace edits can earn a user points.

Most of the above require separate social extensions to be installed and configured. However, there are actions for which you can give out points without installing separate extensions. These actions are:

  • editing ($wgUserStatsPointValues['edit'])
  • friending another user ($wgUserStatsPointValues['friend'])
  • foeing another user ($wgUserStatsPointValues['foe'])
  • uploading your first avatar ($wgUserStatsPointValues['user_image'])
  • sending a gift ($wgUserStatsPointValues['gift_sent'])
  • receiving a gift ($wgUserStatsPointValues['gift_rec'])

Even if you didn't want to change the defaults, you might need to re-define one $wgUserStatsPointValues after including EditCount.php and defining $wgUserLevels. You could just add the following default to your wiki's settings, assuming that you don't want to change it:

$wgUserStatsPointValues['edit'] = 50;

After UserLevels is configured, you might want to visit Special:UpdateEditCounts to initialize the points (requires you to have the updatepoints user right). You should also visit this page every time after changing $wgUserStatsPointValues. There's also a maintenance script that will perform the update from the command line: UserStats/maintenance/updateUserStats.php.

The list of users with the most points can be seen at Special:TopUsers.

User gifts edit

  • $wgMaxCustomUserGiftCount — maximum number of private custom gifts that a user may create. If not set (as per default), normal users cannot access Special:GiftManager, only those with giftadmin privileges can access it. Note that when this is set, users can create their own gifts but they cannot delete them.
  • $wgGiveGiftPerRow(description needed)

Restricted special pages edit

Certain special pages introduced by SocialProfile extension are restricted to the staff user group by default. To enable access to the special page Special:PopulateUserProfiles, create a user group called staff and add yourself into the group.

If you do not want to create such a user group however, you can manually edit the file extensions/SocialProfile/UserProfile/SpecialPopulateUserProfiles.php.

Custom profile info edit

The titles of the custom text input boxes can be changed via the following system messages:

  • MediaWiki:Custom-info-field1
  • MediaWiki:Custom-info-field2
  • MediaWiki:Custom-info-field3
  • MediaWiki:Custom-info-field4

Logging edit

SocialProfile adds two logs: avatar log (Special:Log/avatar), which tracks avatar image uploads and user profile log (Special:Log/profile), which tracks changes to users' social profiles. Since rev:37590, both logs can be hidden from the recent changes as they tend to flood it quickly.

  • To turn off the display of avatar uploads, set: $wgUploadAvatarInRecentChanges = false;
  • To turn off the display of user profile changes, set: $wgUpdateProfileInRecentChanges = false;

Permissions edit

  • avatarremove — allows access to Special:RemoveAvatar, it allows removal of others' avatars. Given to 'sysop' and 'staff' groups by default.
  • awardsmanage — allows access to Special:PopulateAwards and Special:SystemGiftManager. Given to 'awardsmanage', 'sysop' and 'staff' groups by default.
  • editothersprofiles — allows access to Special:EditProfile, a special page to edit other users' social profiles. Given to the 'staff' group by default; since 84989.
  • generatetopusersreport — allows accessing Special:GenerateTopUsersReport, which can be used to generate the report of top users, and thus to give out points for having the most points for a week or for a month; available since r91854. By default no group has this right.
  • giftadmin — allows access to Special:GiftManager. Given to 'giftadmin', 'sysop' and 'staff' groups by default.
  • updatepoints — available since r50604. Users with this right are allowed access to Special:UpdateEditCounts. By default no group has this right.
  • userboard-delete — available since r50565. Users with this right can delete other users' board messages. By default no group has this right.

Working against spam edit

To prevent spambots from creating a social profile page right after registering, you can use $wgUserProfileThresholds. For example, to require a user to have five edits before they're allowed to update their profile, set:

$wgUserProfileThresholds = [
    'edits' => 5

To require a user to have 10 edits and 3 friends before they're allowed to update their profile, set:

$wgUserProfileThresholds = [
    'edits' => 10, 
    'friend-count' => 3