Extension:SocialProfile/Developer information

Overview
SocialProfile consists of 8 components:


 * SystemGifts &mdash; awards functionality
 * UserBoard &mdash; user-to-user messages
 * UserGifts &mdash; gifting functionality
 * UserProfile &mdash; social profile pages
 * UserRelationship &mdash; friend/foe relationships
 * UserStats &mdash; statistics, such as the User Levels system
 * UserSystemMessages &mdash; used to send "You have advanced to level [fill in this]" messages to users when User Levels is activated ($wgUserLevels is defined)
 * UserWelcome &mdash; &lt;userWelcome/&gt; parser hook for displaying social info on a wiki page

Of these, UserWelcome is not enabled by default.

If you want to become a SocialProfile developer, feel free to drop Jack Phoenix a line and then apply for commit access.

CSS
The  (and  ) CSS class is defined in the same, identical way in all of the following SocialProfile files (as of 16:17, 16 December 2013 (UTC)):


 * UserRelationship/UserRelationship.css
 * UserBoard/BoardBlast.css
 * UserBoard/UserBoard.css
 * UserProfile/UserProfile.css

So whenever you want to change clearfix CSS, remember to update all of these files for the intended effect! Maybe we can get this CSS added to MediaWiki core for 1.23 or 1.24 release...

Uploads
SocialProfile has three special pages, which are used to upload images that are used by SocialProfile:


 * Special:UploadAvatar (SocialProfile/UserProfile/SpecialUploadAvatar.php), which stores its files in $wgUploadPath/avatars, is used to upload users' avatars. This special page can be accessed via the social profile page by any user who has the 'upload' user right (any registered user by default).
 * Special:GiftManagerLogo (SocialProfile/UserGifts/SpecialGiftManagerLogo.php), which stores its files in $wgUploadPath/awards, is used to upload images associated with user-to-user gifts. This special page can be accessed via Special:GiftManager by any user with the 'giftmanager' user right (administrators and members of the staff group by default). If $wgMaxCustomUserGiftCount is greater than 0, then normal users (users without the 'giftmanager' user right) can access this special page, too.
 * Special:SystemGiftManagerLogo (SocialProfile/SystemGifts/SpecialSystemGiftManagerLogo.php), which stores its files in $wgUploadPath/awards, is used to upload award (system gift) images. This special page can be accessed by users with the 'awardsmanage' user right (administrators and members of the staff group by default).

Files uploaded via these special pages are not treated as normal MediaWiki files.

Image file name formats:
 * user avatars: $wgDBname_USERID_SIZE.EXTENSION (i.e. testwiki_1_l.png; size can be l for large, ml for medium-large, s for small)
 * gift images: GIFTID_SIZE.EXTENSION (i.e. 4_m.gif)
 * award (system gift) images: sg_SYSTEMGIFTID_SIZE.EXTENSION (i.e. sg_15_s.jpg)

In the past, all of these special pages used ImageMagick to resize the images. Since r93067, PHP's GD library has been supported so SocialProfile's image uploads should function properly even on platforms where ImageMagick is not available.

Hooks
There are several hooks in the SocialProfile codebase which allow you to alter or inject data.

If you need more hooks added to the core of SocialProfile, please discuss with Jack Phoenix about it, preferrably providing a good reason why a new hook should be added. :-)

Customization of Profile
You can add anything above and below both columns of the profile by the following hooks:

Example extension that uses UserProfile's hooks
The following piece of code adds a "Xbox Gamecard" section to social profile pages, as seen on :

Translations
Notice that your language isn't translated at all or that the translation is incomplete? Internationalization patches are always welcome. See How to become a MediaWiki hacker for info about how to generate a patch file. After you've finished your patch, please email it to Jack Phoenix (jack@undefinedcountervandalism.net).