You want to create a category in the Forum (see Section 7.1.1), but you get the error:
General Error
Can't create a category without a name
Your strategy in coping with error messages, in case your error is not obvious or not well explained by the message, is to search the whole code tree for the error text (just as you would search
for a link text in Section 26.5). In this case, it turns out that there is only one occurence, in modules/Forums/admin/admin_forums.php:
case 'addcat':
// Create a category in the DB
if( trim($HTTP_POST_VARS['categoryname']) == '')
{
message_die(GENERAL_ERROR, "Can't create a category without a name");
}
As you can easily see, the error is issued if the category name contains only "white space"[1] (which is what the PHP trim function strips from the beginning and end of a string), in simple words: if you did not enter any name for the category.
Logical, isn't it?
But what happens if you swear that you did enter a name there? Isn't this error going to drive you nuts then?
In such situations, you should keep your calmness and try to think further than the obvious: what could be happenning behind the scenes in PHP-Nuke? Here are some possibilities (see Can't create a category without a name):
You entered an empty name - O.K., you already checked that, but let's include it, just for the sake of completeness. This means that $HTTP_POST_VARS['categoryname'], the value of the POST variable
that holds the category name, is empty, or contains at most some white space.
Your browser does not send POST variables back to the server, e.g. it does not support forms. Also quite unlikely.
$HTTP_POST_VARS['categoryname'] was not empty when it arrived at PHP-Nuke, but PHP-Nuke changed it. In fact, PHP-Nuke subjects the
POST and GET variables to some sanity checks (see Section 23.4.3 for details), to see if they contain malicious code. If your category name contained any "forbidden"
characters, it may be that some check routine in PHP-Nuke deleted it. Try a name that will not raise suspicions of SQL injection (Section 23.3.2) and similar attacks.
You are logged in as the administrator and as a user. In this case, you browser has stored two cookies (Section 23.4.5) on your computer and it is not clear
under what ID your action has been evaluated by PHP-Nuke. Try to avoid such situations. If you must me logged in as both a user and
an administrator at all costs, you might try to use two different browsers for each ID (not two instances of the same browser, but two different products). They
will store the cookies in different locations and will (hopefully) not mess them up.