Hi,
I was asking that it's possible to change theme from the url of board.
In vbulletin it's possibile so: url/index.php?style=IDTHEME
I tried also with MyBB but don't work.
I know that exist plugin to change theme but so it's more easy, especially for a preview of theme.
Thanks ~
It'll need a plugin, moved to requests.
Can I use this code?
if ($mybb->input['style']) {
$query = $db->query("UPDATE ".TABLE_PREFIX."users SET style = ".$mybb->input['style']." WHERE uid ='{\$mybb->user['uid']}'");
}
It works but only with registered users, for visitors, how can I do?
Now I modify the code with this:
if (! $mybb->user['uid']) { // controllo che l'utente non sia loggato
if ($mybb->cookie['style'] == FALSE) { // controllo che non sia presente il cookie style nel computer del visitatore
$loadstyle = "def='1'"; // se il controllo precedente ha successo, carico il tema di default
$query = $db->simple_select("themes", "name, tid, properties, stylesheets", $loadstyle, array('limit' => 1));
$theme = $db->fetch_array($query);
if ($mybb->input['style']) { // Se da visitatore inserisco nell'url ?style=IDTEMA
$style = intval($mybb->input['style']); // do alla variabile style il valore INTERO del get
my_setcookie("style", $style); // scrivo la variabile nel cookie style
}
} else {
$loadstyle = "def='{$mybb->cookie['style']}'"; // Se il cookie style è presente nel pc del visitatore, setto come tema di default il contenuto del cookie
$query = $db->simple_select("themes", "name, tid, properties, stylesheets", $loadstyle, array('limit' => 1));
$theme = $db->fetch_array($query);
}
}
if ($mybb->user['uid']) { // Se l'utente è loggato estrapolo il valore del campo style della tabella users e lo setto come stile per esso
$query = $db->query("SELECT style FROM ".TABLE_PREFIX."users WHERE uid='{$mybb->user['uid']}'");
$theme = $db->fetch_array($query);
}
At line 191-209 of global.php but doesn't work also for logged users.
Any ideas?