// Allow folks to override user themes and always use their own on their own site.
// This works only if the user is on the same server
$user = $this->database->selectFirst('user', ['theme'], ['uid' => $this->profile_owner]);
- if ($this->database->isResult($user) && !$this->pConfig->get(local_user(), 'system', 'always_my_theme')) {
+ if ($this->database->isResult($user) && !local_user()) {
$page_theme = $user['theme'];
}
}
if (!empty($this->profile_owner) && ($this->profile_owner != local_user())) {
// Allow folks to override user themes and always use their own on their own site.
// This works only if the user is on the same server
- if (!$this->pConfig->get(local_user(), 'system', 'always_my_theme')) {
+ if (!local_user()) {
$page_mobile_theme = $this->pConfig->get($this->profile_owner, 'system', 'mobile-theme');
}
}
DI::page()['title'] = $profile['name'] . ' @ ' . DI::config()->get('config', 'sitename');
- if (!DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) {
+ if (!local_user()) {
$a->setCurrentTheme($profile['theme']);
$a->setCurrentMobileTheme(DI::pConfig()->get($a->getProfileOwner(), 'system', 'mobile_theme'));
}
*
* Used from within PCSS themes to set theme parameters. If there's a
* profile_uid variable set in App, that is the "page owner" and normally their theme
- * settings take precedence; unless a local user sets the "always_my_theme"
- * system pconfig, which means they don't want to see anybody else's theme
- * settings except their own while on this site.
+ * settings take precedence; unless a local user is logged in which means they don't
+ * want to see anybody else's theme settings except their own while on this site.
*
+ * @param App $a
* @return int user ID
*
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @note Returns local_user instead of user ID if "always_my_theme" is set to true
*/
- public static function getThemeUid(App $a)
+ public static function getThemeUid(App $a): int
{
- $uid = !empty($a->getProfileOwner()) ? intval($a->getProfileOwner()) : 0;
- if (local_user() && (DI::pConfig()->get(local_user(), 'system', 'always_my_theme') || !$uid)) {
- return local_user();
- }
-
- return $uid;
+ return local_user() ?: $a->getProfileOwner();
}
/**