abramelin wrote: can i make this for registered users?
abramelin wrote: how can i make it?can you give some example codes?
Code: Select all
#
#-----[ FIND ]------------------------------------------
#
if ( $theme = setup_style($userdata['user_style']) )
{
return;
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
//BEGIN Random Styles for Guests MOD
if (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'].'_rand_style']))
{
$rand_style = $HTTP_COOKIE_VARS[$board_config['cookie_name'].'_rand_style'];
$theme = setup_style($rand_style);
}
else
{
global $db;
$sql = "SELECT *
FROM " . THEMES_TABLE . "
ORDER BY RAND() LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not query database for theme info');
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
}
$rand_style = $row['themes_id'];
$theme = setup_style($rand_style);
setcookie($board_config['cookie_name'].'_rand_style', $rand_style, (time()+900), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
}
return;
//END Random Styles for Guests MOD
DavidIQ wrote:abramelin wrote:how can i make it?can you give some example codes?
Make a backup of includes/functions.php in case this doesn't work:
Code: Select all
# #-----[ FIND ]------------------------------------------ # if ( $theme = setup_style($userdata['user_style']) ) { return; } # #-----[ REPLACE WITH ]------------------------------------------ # //BEGIN Random Styles for Guests MOD if (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'].'_rand_style'])) { $rand_style = $HTTP_COOKIE_VARS[$board_config['cookie_name'].'_rand_style']; $theme = setup_style($rand_style); } else { global $db; $sql = "SELECT * FROM " . THEMES_TABLE . " ORDER BY RAND() LIMIT 1"; if ( !($result = $db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Could not query database for theme info'); } if ( !($row = $db->sql_fetchrow($result)) ) { message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]"); } $rand_style = $row['themes_id']; $theme = setup_style($rand_style); setcookie($board_config['cookie_name'].'_rand_style', $rand_style, (time()+900), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); } return; //END Random Styles for Guests MOD
Cardcaptor Stacey wrote: I've just this minute installed it and I love it!
How would I do it so that it doesn't randomise all skins? I have two skins I don't want to be included.
Code: Select all
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT *
FROM " . THEMES_TABLE . "
ORDER BY RAND() LIMIT 1";
#
#-----[ REPLACE WITH ]----------------------------------
#
$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE themes_id != 1 AND themes_id != 2
ORDER BY RAND() LIMIT 1";