Phần mở rộng:UserProfileV2
Trạng thái phát hành: ổn định |
|
|---|---|
| Cài đặt | API , Database , MyWiki |
| Mô tả | Cung cấp tính năng trang hồ sơ người dùng đơn giản trực quan |
| Tác giả | Telepedia (Original Authority thảo luận ) |
| Phiên bản | 1.0.4 (2025年03月02日) |
| Compatibility policy | Main branch maintains backward compatibility. |
| MediaWiki | 1.41+ |
| PHP | 8.0+ |
| Giấy phép | GNU General Public License 2.0 or later |
| Tải xuống | GitLab: README |
|
wgUserProfileV2Color, wgUserProfileV2AvatarBorderRadius, wgUserProfileV2Backend |
|
|
profilemanager |
|
| Translate the UserProfileV2 extension | |
UserProfileV2 là tiện ích mở rộng MediaWiki để hiển thị Hồ sơ người dùng trong MediaWiki. Nó được xây dựng để thay thế SocialProfile trên Telepedia và trở thành thành phần hồ sơ người dùng cơ bản và mạnh mẽ hơn mà không biến MediaWiki thành một trang mạng xã hội.
UserProfileV2 được phát triển với mục đích hoạt động trên các máy chủ trang trại wiki, chủ yếu tương thích với Telepedia và Miraheze — tuy nhiên nó cũng sẽ hoạt động trên các wiki đơn lẻ, chỉ là quá trình phát triển dựa trên hệ sinh thái trang trại wiki sử dụng CentralAuth.
Cài đặt
- Tải và đặt (các) tệp trong một thư mục với tên
UserProfileV2trong thư mụcextensions/của bạn. - Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
wfLoadExtension( 'UserProfileV2' );
- Thiết lập theo nhu cầu của bạn
- Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.
Cách dùng
UserProfileV2 will replace the default user page fetched when MediaWiki renders a page within the User: and User talk: namespaces.
Nội dung của trang người dùng sẽ được hiển thị ngay bên dưới tiêu đề.
Tất cả dữ liệu cho hồ sơ được lưu trữ trong phần tùy chọn và được JS truy cập thông qua API. Người dùng có thể chỉnh sửa hồ sơ của mình bằng cách nhấp vào nút Sửa khi đang ở trên hồ sơ hoặc thông qua tùy chọn của họ — giao diện để chỉnh sửa hồ sơ từ trang người dùng được viết hoàn toàn bằng JS nên sẽ không hoạt động nếu người dùng đã tắt JS. Người dùng cũng có thể tải lên hình đại diện tùy chỉnh của họ tại trang hồ sơ người dùng.
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.
Người có quyền này có thể xóa ảnh đại diện của người dùng nhưng không thể tải lại ảnh đại diện khác (vì những lý do hiển nhiên).
Chú ý
- Hiện tại không có phương pháp nào khác để lấy ảnh đại diện người dùng toàn cục ngoài việc sử dụng ID CentralAuth của người dùng. Có lẽ trong tương lai, tính năng này có thể dựa vào CentralIdProvider, nhưng hiện tại thì việc này là không khả thi.
- Nếu chạy một trang trại wiki, sẽ tương đối an toàn khi có một số wiki nhất định sử dụng hình đại diện toàn cục và một số wiki nhất định sử dụng hình đại diện cục bộ vì hình đại diện toàn cục sử dụng khóa bộ nhớ đệm toàn cục thay vì khóa cục bộ; tuy nhiên, điều này vẫn chưa được kiểm chứng.
Móc nối (hooks)
UserProfileV2 provides one hook:
PHP
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
| 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
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
- Extension:SocialProfile - the original of which this extension was based on.
- Stable extensions/vi
- API extensions/vi
- Database extensions/vi
- Personalization extensions/vi
- GPL licensed extensions/vi
- Extensions in GitLab version control/vi
- Extensions which add rights/vi
- ArticleFromTitle extensions/vi
- GetPreferences extensions/vi
- All extensions/vi
- Extensions included in Miraheze/vi
- Extensions included in Telepedia/vi