In some cases you may need to change the PHP-Nuke header according to some globally available information about the current user. For example, you may want to
display a menu that is differently structured if the user's language is, say, french, leaving the standard menu structure untouched otherwise.
The key to such changes is always to declare the globally available feature as being "global" in the themeheader() function in theme.php. Then you can use its value for a simple check that will
echo the right HTML incantations if the check succeeds. Let's take for example the above case, where the globally available feature is nothing else but the current language setting:
global $currentlang;
if ($currentlang == "french") {
echo "<a href=\"/special/link/to/my/services/for/french/users\"><b>"
._MESSERVICES."</b></A>\n";
}
else if ($currentlang == "english") {
echo "<a href=\"/some/default/link/for/other/users\">"
._DEFAULTLINK."</a>\n";
}
This code, put in the themeheader() function of theme.php in the aproppriate place (depending on where exacly you want it to appear), will display a special menu link if the user's language is
french. Instead of the current language, any user setting that is globally available can be used. The only work you have to do is to find out which variable stores the global setting you need
($currentlang in the above example).
User information is stored in the userinfo array. This array is filled with a call to the getusrinfo() function. Thus a simple way to arrive at some information that is special to the currently
logged-in user, is to write somethink like
global $user, $userinfo;
if(is_user($user)) {
getusrinfo($user);
}
You have then some user-specific settings at your disposal: