@luceos
Get your help
The code below just triggers f5 to reload the page to add the class to the content.
Normally after logging in, the code below does not add the class.
extend.php
use Flarum\Extend;
use Flarum\Frontend\Document;
use Flarum\Http\RequestUtil;
use Laminas\Diactoros\ServerRequest as Request;
return [
(new Extend\Frontend('forum'))
->content(function (Document $document, Request $request) {
$actor = RequestUtil::getActor($request);
if (! $actor->isGuest()) {
$document->head[] = <<<HTML
<script>
/*window.addEventListener("load", ()=>{
var body = document.body;
body.classList.add("logged-in-new");
});*/
document.addEventListener("DOMContentLoaded", function() {
var body = document.body;
body.classList.add("logged-in-new");
});
</script>
HTML;
}
}),
];
F5 reloads the page, the above code always works on every link