@@ -25,6 +25,71 @@ $event->setLink($object->getLink());
2525$event->setImage(new ImageData('image_src', 800, 600));
2626```
2727
28+ ## User Profile Header
29+
30+ The header in the user profile has been completely overhauled.
31+ Main goal of this change is the overhaul of the visuals of the user profile header.
32+ At the same time, the use of a view removes a lot of business logic from the templates and simplifies extensibility through a clear API.
33+
34+ ### Stats
35+
36+ You can add your own counters to the user profile header via a dedicated event. The use of template listeners is no longer necessary.
37+
38+ Example:
39+
40+ ``` php
41+ EventHandler::getInstance()->register(
42+ \wcf\event\user\profile\UserProfileStatItemCollecting::class,
43+ static function (\wcf\event\user\profile\UserProfileStatItemCollecting $event) {
44+ if ($event->user->exampleCounter) {
45+ $event->register(\wcf\system\view\user\profile\UserProfileStatItem::forLink(
46+ WCF::getLanguage()->get('phrase.exampleCounter'),
47+ StringUtil::formatNumeric($event->user->exampleCounter),
48+ LinkHandler::getInstance()->getControllerLink(
49+ \example\page\ExampleListPage::class,
50+ ['object' => $event->user]
51+ )
52+ ));
53+ }
54+ }
55+ );
56+ ```
57+
58+ ### Search Content Links
59+
60+ Additional links for searching for content can also be added via a dedicated event.
61+
62+ Example:
63+
64+ ``` php
65+ EventHandler::getInstance()->register(
66+ \wcf\event\user\profile\UserProfileHeaderSearchContentLinkCollecting::class,
67+ static function (\wcf\event\user\profile\UserProfileHeaderSearchContentLinkCollecting $event) {
68+ if ($event->user->exampleCounter) {
69+ $event->register(new \wcf\system\view\user\profile\UserProfileHeaderViewSearchContentLink(
70+ WCF::getLanguage()->get('phrase.exampleCounter'),
71+ LinkHandler::getInstance()->getControllerLink(
72+ \example\page\ExampleListPage::class,
73+ ['object' => $event->user]
74+ )
75+ ));
76+ }
77+ }
78+ );
79+ ```
80+
81+ ### Interactions
82+
83+ Two different interaction menus are available in the user profile header.
84+ Corresponding events are available for both menus to add custom menu items.
85+ An example of this can be found in the [ interaction documentation] ( ../../php/api/interactions.md#events ) .
86+
87+ | Type | Class Name | Event Class Name |
88+ | -----------------------------| ------------------------------| ---------------------------------------|
89+ | General interactions. | ` UserProfileInteractions ` | ` UserProfileInteractionCollecting ` |
90+ | Administrative interactions | ` UserManagementInteractions ` | ` UserManagementInteractionCollecting ` |
91+
92+
2893## Deleted Content Provider
2994
3095A new interface [ ` IDeletedContentListViewProvider ` ] ( https://github.com/WoltLab/WCF/blob/6.2/wcfsetup/install/files/lib/system/moderation/IDeletedContentListViewProvider.class.php ) for displaying deleted content in the moderator panel based on a [ list view] ( ../../php/api/list_views.md ) has been added.
0 commit comments