PHP-Nuke comes with several standard themes. It gives your registered users the possibility to change the theme at the click of a button (see Chapter 6). But what if you don't want your users to do that? What if you want them to stay with the default theme you chose in the Preferences (see Section 7.1) of the administration panel?
There are two ways to achieve this (see I do not want to let users choose their own themes):
You delete all themes except the one chosen by you. Themes are stored in the themes folder, under directories that carry the theme name. PHP-Nuke counts the available themes in function nav() of the file modules/Your_Account/navbar.php:
$handle=opendir('themes'); while ($file = readdir($handle)) { if ( (!ereg("[.]",$file)) ) { $thmcount++; } } closedir($handle); |
If the theme count $thmcount is greater than 1 - and only then - , the registered user is presented the possibility to change the theme. This is done again in function nav() of modules/Your_Account/navbar.php a few lines further down:
if ($thmcount > 1) { $menuimg = menuimg("themes.gif"); echo "<td width=\"10%\"><font class=\"content\">" ."<center><a href=\"modules.php?name=Your_Account&op=chgtheme\"> <img src=\"$menuimg\" border=\"0\" alt=\"" ._SELECTTHETHEME."\" title=\""._SELECTTHETHEME."\"></a><br>" ."<a href=\"modules.php?name=Your_Account&op=chgtheme\">" ._SELECTTHETHEME."</a>" ."</center></form></font></td>"; } |
Thus, by deleting all other themes you will get a theme count of only 1 and the theme change functionality will not be available to the user.
Why get to all the trouble and delete whole theme directories? From what we said above, it should suffice just as well to replace the line
if ($thmcount > 1) { |
with
if ($thmcount > 1000) { |
Unless you really installed more than a thousand themes, your users are not going to get the chance to change the default one!
Choose the first solution, if you don't want to touch the code, choose the second one, if you are lazy.
Don't delete themes if you already have registered users! | ||
---|---|---|
Do the above changes before you go online and start getting registered users. Why? Because if you already have some, you don't know if the theme they chose in the User Preferences was the one you want to be the default. If it is not, and you apply either solution above, then those users will not be able to get into your site! Either the theme they specified will not be there, or they will not be able to change it. The first solution has the extra disadvantage that if you choose to change the default theme, you will need to move it under the themes folder. Thus, even for a very short period of time, you will end up having two themes available. You never know if a user just chose the theme you wanted to remove as her default theme. That user will be denied access to your site the next time she tries, because the theme will not be there anymore! In cases you do have registered users, you are thus advised to run the following SQL statement, either from the MySQL prompt, or through a graphical frontend, like phpMyAdmin:
This will set the theme to blank for all users, making it for them possible to change it to the default one afterwards, see disabling themes and also Where is the themeheader function located?. |