Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Change theme when logged in  (Read 3367 times)

0 Members and 1 Guest are viewing this topic.

nickelas

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Change theme when logged in
« on: June 22, 2011, 10:51:44 am »

I want to use a different theme when the user has logged in.
I found this old link that describes how to change the theme if the user is on a wii

So I guess you can check if (USER_ID) and then set $USER['theme']? Is it possible to do that in theme.php?

http://uppsalafoto.se/galleri/
Logged
Human

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Change theme when logged in
« Reply #1 on: June 22, 2011, 01:44:27 pm »

Is it possible to do that in theme.php?
Might be possible, but then the theme will not change immediately after login, but one page load later. Don't forget the else block so the theme will be switched back to your default theme after logout.
Logged

nickelas

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: Change theme when logged in
« Reply #2 on: June 29, 2011, 12:31:49 am »

Thanks,
I put the code in the section
theme_html_picture
and it works, but only after visiting an intermediate page. So better to put it on the index-page since that is where you go after logging in. I tried it in
theme_display_album_list
but then nothing happens. Any hint on what can go wrong?

Code: [Select]
if (USER_ID){
$USER['theme'] = 'customtheme';
}
Logged
Human

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Change theme when logged in
« Reply #3 on: June 29, 2011, 12:11:43 pm »

I suggest to put it 'directly' into your theme.php file (i.e. in no function). I haven't tested that, but it should work.
Logged

nickelas

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: Change theme when logged in
« Reply #4 on: June 29, 2011, 10:13:11 pm »

Thanks, appears to be working
Logged
Human
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 19 queries.