PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 
Site Navigation

Home:

 
Donate o Meter
Help Keep Our Servers Online AND Our Services Free!
Make donations with PayPal!
Donations
Anonymous May-24
Doulos May-15
Webservant May-11
AndyB May-5
Hotdog May-3
 
Please Link To Me!
 
Quality Web Hosting For All PHP Applications
Quality PHP Web Host!

Great Reviews!
Need help setting up your website, installing Apache, PHP, MySQL, or RavenNuke(tm)?
Need help customizing or designing scripts?
Please contact us via the Contact Us option for further details and pricing.

Link to Me

RavenPHPScripts

RavenPHPScripts

There are more Link To Me icons here.
 
Site Info v2.2.2 ©
Your IP: 38.107.179.231

 Welcome, Anonymous
Nickname
Password
Security Code:
Security Code
Type Security Code:

· Register
· Lost Password
Server Date/Time
24 May 2012 23:02:09 EDT (GMT -4)
 
How to prevent users from changing the theme in PHP-Nuke

14.10. How to prevent users from changing the theme in PHP-Nuke

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):

  1. 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&amp;op=chgtheme\">
                <img src=\"$menuimg\" border=\"0\" alt=\""
                ._SELECTTHETHEME."\" title=\""._SELECTTHETHEME."\"></a><br>"
                ."<a href=\"modules.php?name=Your_Account&amp;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.

  2. 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.

Warning 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:

update nuke_users set theme=";

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?.

 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum