diff --git a/appinfo/app.php b/appinfo/app.php new file mode 100644 index 0000000..5a37b71 --- /dev/null +++ b/appinfo/app.php @@ -0,0 +1,6 @@ +Minimal Profile Hides profile fields to create a minimal user profile Allows administrators to hide profile fields like pronouns, social links, etc. - 1.0.21 + 1.0.22 AGPL Your Name MinimalProfile diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index e995418..277bfec 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -1,61 +1,18 @@ registerService(IConfig::class, function($c) { - return $c->get(IConfig::class); - }); - - $context->registerEventListener( - TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS, - function() { - Util::addStyle('minimalprofile', 'minimalprofile'); - } - ); - } - + public function register(IRegistrationContext $context): void {} public function boot(IBootContext $context): void { - $config = $context->getAppContainer()->query(IConfig::class); - $value = $config->getAppValue('minimalprofile', 'hidden_fields', ''); - $hidden = ($value !== '') ? json_decode($value, true) ?? [] : []; - - $css = ''; - if (!empty($hidden)) { - $selectors = [ - 'pronouns' => '#account-property-pronouns', - 'role' => '#account-property-role', - 'headline' => '#account-property-headline', - ]; - foreach ($hidden as $field) { - if (isset($selectors[$field])) { - $css .= $selectors[$field] . ' { display: none !important; }' . "\n"; - } - } - } - - if ($css) { - Util::addInlineStyle($css); - } - - file_put_contents('/tmp/mp_loaded.log', date('Y-m-d H:i:s') . ' boot ran, hidden: ' . print_r($hidden, true) . ", css: $css\n", FILE_APPEND); + Util::addStyle('minimalprofile', 'minimalprofile'); } } \ No newline at end of file