forked from Cavemanon/cavepaintings
Added $user_config global based on existing config object for storing user-specific settings.
Added event to the user page so that extensions can hook into it, providing user-specific setting controls
This commit is contained in:
@@ -19,6 +19,17 @@ class UserBlockBuildingEvent extends Event
|
||||
}
|
||||
}
|
||||
|
||||
class UserOptionsBuildingEvent extends Event
|
||||
{
|
||||
/** @var array */
|
||||
public $parts = [];
|
||||
|
||||
public function add__html(string $html)
|
||||
{
|
||||
$this->parts[] = $html;
|
||||
}
|
||||
}
|
||||
|
||||
class UserPageBuildingEvent extends Event
|
||||
{
|
||||
/** @var User */
|
||||
@@ -254,6 +265,17 @@ class UserPage extends Extension
|
||||
|
||||
ksort($event->stats);
|
||||
$this->theme->display_user_page($event->display_user, $event->stats);
|
||||
|
||||
if (!$user->is_anonymous()) {
|
||||
if ($user->id == $event->display_user->id || $user->can("edit_user_info")) {
|
||||
$uobe = new UserOptionsBuildingEvent();
|
||||
send_event($uobe);
|
||||
|
||||
$page->add_block(new Block("Options", $this->theme->build_options($event->display_user, $uobe), "main", 60));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($user->id == $event->display_user->id) {
|
||||
$ubbe = new UserBlockBuildingEvent();
|
||||
send_event($ubbe);
|
||||
|
Reference in New Issue
Block a user