Jump to content

Recommended Posts

Posted (edited)
$settings = ['it' => 12, 'en' => 1];
foreach ( $settings as $k => $v )
{
	if( $this->member->skin !== $v AND \strtolower( \substr( $this->member->language()->short, 0, 2 ) ) === $k )
	{
		$this->member->skin = $v;

		if( $this->member->member_id )
		{
			$this->member->save();
		}
	}
}
return call_user_func_array( 'parent::getTheme', func_get_args() );

but this code is valid only if you overload \IPS\Session\Front::getTheme

With switchTheme the theme is set only for current location, with getTheme overload you can set it permanently only once occur preventing more call or redirection (like a silent code that automatically cover default IPS code and your needs)

 

Edited by BomAle
data['theme_id'] only affect ajax call...
Posted
$settings = ['it' => 12, 'en' => 1];
foreach ( $settings as $k => $v )
{
	if( $this->member->skin !== $v AND \strtolower( \substr( $this->member->language()->short, 0, 2 ) ) === $k )
	{
		$this->member->skin = $v;

		if( $this->member->member_id )
		{
			$this->member->save();
		}

		return NULL;
	}
}
return call_user_func_array( 'parent::getTheme', func_get_args() );

this will work for sure (return NULL prevent resetting to default theme see system/Theme/Theme.php:284)

1FyW5wY.png

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...