Extension:UserProfileV2
UserProfileV2 Release status: beta |
|
---|---|
Implementation | API , Database , MyWiki |
Description | Displaying user profile page in an interactive manner |
Author(s) | Telepedia (Original Authoritytalk) |
Latest version | 2.0.0 (2024/10/01) |
MediaWiki | >=1.41.0 |
PHP | >=8.0 |
License | GNU General Public License 2.0 or later |
Download | GitLab: README |
wgUserProfileV2Color, wgUserProfileV2AvatarBorderRadius, wgUserProfileV2Backend |
|
profilemanager |
|
Translate the UserProfileV2 extension | |
UserProfileV2 is a MediaWiki extension for displaying User Profiles in MediaWiki. It was built to replace SocialProfile on Telepedia and to be a more robust and basic profile elements without turning MediaWiki into a social networking site.
UserProfileV2 was developed with the intention of working on Wiki Farms, mainly being compatible with Telepedia and Miraheze â it will also work on single-wikis but development is based on a wiki farm ecosystem using CentralAuth.
Installation
[edit]- Download and place the file(s) in a directory called
UserProfileV2
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'UserProfileV2' );
- Configure as required.
- Done â Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Usage
[edit]UserProfileV2 will replace the default user page fetched when MediaWiki renders a page within the User:
and User talk:
namespaces. The content of the userpage will be shown directly below the masthead.
All of the data for the profile is stored in preferences, and accessed by JS over an API. Users can edit their profile by clicking the edit button whilst on their profile or via their preferences â the interface for editing a profile from a user page is entirely written in JS so will not work if a user has JS disabled. Editing an avatar is also possible from a user page.
System Administrators etc can assign the profilemanager
permission to a specific user group to allow them to modify a users profile to remove spam etc. Someone with this right can delete a users avatar but cannot re-upload a different avatar (for obvious reasons).
Notes
[edit]- There is currently no support for other methods of getting a global user avatar other than using the user's CentralAuth ID. Perhaps in the future this could rely on the CentralIdProvider, but it currently does not.
- If running a wiki farm, it should be relatively safe to have certain wikis on global avatars and certain wikis using local avatars since global avatars use a global cache key as opposed to a local one; this, however, has not been tested.
Hooks
[edit]UserProfileV2 provides one hook:
public static function onUserProfileV2ProfileAfterMasthead(User $user, &$html) {}
You have access to the $user, which corresponds to the user profile of the person you are viewing, and the $html, which you can use to add html to the output. The Html will appear below the user masthead and before the content of the page, such as:
public static function onUserProfileV2ProfileAfterMasthead(User $user, &$html): void {
$html .= Html::warningBox(
"This is {$user->getName()} user profile"
);
}
Configurations
[edit]Parameter | Default | Comment |
---|---|---|
$wgUserProfileV2Color
|
#E1E1E1
|
The accent/secondary colour used for the extension. This is used as a background colour for the user group tags and the avatar edit button. |
$wgUserProfileV2AvatarBorderRadius
|
"50%"
|
The border-radius applied to the user avatar. |
$wgUserProfileV2Backend
|
""
|
The backend that should be used for uploading avatars. Should correspond to a defined backend in $wgFileBackends
|
$wgUserProfileV2UseGlobalAvatars
|
false
|
Whether or not to signal that global avatars are being used. When set to true, the extension will construct a global cache key with a user id from CentralAuth instead of a local cache key. Do not set to true if you are not using CentralAuth as it will just throw exceptions. |
$wgUserProfileGlobalUploadBaseUrl
|
""
|
The base url for uploads if you are using a different backend (defined by $wgUserProfileV2Backend ), or if you are using a backend like Amazon S3 via the AWS extension
|
$wgUserProfileV2CacheType
|
""
|
The cache that UserProfileV2 should store generated paths to avatars. Should correspond to a key in $wgObjectCaches . If not set it will use ObjectCache::getLocalClusterInstance()
|
Avatars backend
[edit]UserProfileV2 will use the backend defined in $wgUserProfileV2Backend
if it is set, which allows you to use a backend such as S3 or Swift. This must correspond to a backend registered with $wgFileBackends
such as
$wgFileBackends[] = [
'class' => SwiftFileBackend::class,
'name' => 'userprofilev2',
'wikiId' => $wgDBname,
// more configuration here
];
It is possible to have global avatars (instead of each wiki using its own avatars) if you set $wgFileBackends
to something like:
$wgFileBackends[] = [
'class' => 'AmazonS3FileBackend',
'name' => 'telepedia-userprofile',
'region' => 'eu-west-2',
'wikiId' => 'global',
'lockManager' => 'nullLockManager',
'connTimeout' => 10,
'reqTimeout' => 900,
'containerPaths' => [
"global-upv2avatars" => "static-test.telepedia.net/upv2avatars"
],
];
The AWS extension is recommended. You also need to set $wgAWSBucketName
and other configs required for the extension. When using global avatars you must provide the base URL for use in constructing the avatars, ie: $wgUserProfileGlobalUploadBaseUrl = 'https://s3.eu-west-2.amazonaws.com/static-test.telepedia.net';
as the path to the file will be appended automatically. (The extension purposefully does not use $wgUploadPath
if you use a different backend because most will have this set with .../$wgDBname
which will not work if you are using global avatars that all need to be read from one URL/directory independent of wiki context.
If you do not provide $wgUserProfileV2Backend
then the extension will construct a new FSFileBackend([])
with configuration for individual wiki avatars.
See also
[edit]- Extension:SocialProfile - the original of which this extension was based on.
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |