[Solved]: different themes for anon & loggid in users? [Solved]: different themes for anon & loggid in users?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[Solved]: different themes for anon & loggid in users?

Started by water, August 01, 2004, 01:56:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

water

i'm considering coppermine for a site where the anon users should see a totally different theme than the logged in users.

is it possible to have different themes for anon & logged in users in coppermine?

:water

Casper

Untested but should work;

Open include/init.inc.php, and find;

if (!file_exists("themes/{$CONFIG['theme']}/theme.php")) $CONFIG['theme'] = 'classic';
require "themes/{$CONFIG['theme']}/theme.php";
$THEME_DIR = "themes/{$CONFIG['theme']}/";
// Process language selection if present in URI or in user profile or try
// autodetection if default charset is utf-8
if (!empty($HTTP_GET_VARS['lang'])) {
   $USER['lang'] = $HTTP_GET_VARS['lang'];
}


Replace it with;

if (USER_ID) {
 $theme='hardwired';
      require "themes/hardwired/theme.php";
      $THEME_DIR = "themes/hardwired/";
} else {

if (!file_exists("themes/{$CONFIG['theme']}/theme.php")) $CONFIG['theme'] = 'classic';
require "themes/{$CONFIG['theme']}/theme.php";
$THEME_DIR = "themes/{$CONFIG['theme']}/";
// Process language selection if present in URI or in user profile or try
// autodetection if default charset is utf-8
if (!empty($HTTP_GET_VARS['lang'])) {
   $USER['lang'] = $HTTP_GET_VARS['lang'];
}
}


This will make logged on users see the hardwired theme, and others the default.
Alter this to what you want.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

water


artistsinhawaii

This doesn't seem to work for cpg1.4x, however, there is a simpler fix for 1.4x users.

In login.php and logout.php search for the line:

Quote$referer = 'index.php

replace with:

Quote$referer = 'index.php?theme=yourtheme"

Where the theme for the registered/logged in user is different from the logged out user.

I did this for a site where none of the coppermine menus show up unless someone logs in first.
I simply created two identical themes, then removed the  {SYS_MENU} {SUB_MENU}
and {ADMIN_MENU} calls from the logged out theme's template.html.

NOTE: This probably doesn't have to return to index.php, you could probably send it off to some other file in your cpg setup - though I haven't tried that  8)

Dennis
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.