2 chris_of_arabia Dec 13, 2008 16:31

I had the same question. And I solved it changed the url name to somethig with any spaces inside, and trying not to repeat any categorie name I had before.
An example: I have a blog called "sponfut" and want to create a new category called "more stuff". So I will use in the URL name something like this: morestuffsponfut (no space and with the blog name inside)
I am sure why it is OK, but...
I'd understand that if I was using duplicate url names or if the ones I was using had spaces, but I'm not doing either. It remains a mystery...
Sorry to bother you guys, but can anyone offer me a way forward on this? I'd rather not be hacking into MySQL each time I need to add a category.
See if the solution in this post ( [url=http://forums.b2evolution.net/viewtopic.php?t=13875&highlight=categories][230RC1] Can't rename a category[/url] ) helps
¥
Thanks ¥åßßå,
So near yet not quite. Did the change 'UNIQUE' to 'INDEX' change on the cat_urllname in MySQL. Within MySQL now, I can add a new category without getting the error message shown above. OK, so we have made some progress.
Try the same thing though though the b2evo back office and I'm getting the same "The url name is invalid" message when using (in this instance) 'c15' as the url name. I then tried just entering '15' as the url name and it worked.
Looking at the db structure, I can't see why an integer would work, yet a character wouldn't, when the type set for cat_urlname is varchar(255) :-/
Just tried creating a category called TEST3 using test3 as the cat_urlname and that works too. Stranger and stranger...
I'd love to know what's going on, but it doesn't seem to like the letter 'c' - this would never happen on Sesame Street
It's caused by the second regex in this section of code ( inc/chapters/model/_chapter.class.php approx 92 )
// Check url name
if( param_string_not_empty( 'cat_urlname', T_('Please enter an urlname.') ) )
{
$this->set_from_Request( 'urlname' );
if( ! preg_match( '|^[A-Za-z0-9\-]+$|', $this->urlname )
|| preg_match( '|^[A-Za-z][0-9]*$|', $this->urlname ) ) // This is to prevent conflict with things such as week number
{
param_error( 'cat_urlname', T_('The url name is invalid.') );
}
Basically you're unable to have any single letter followed by just digits ( try z100 ) ... tad flawed since it uses c## by default :p
¥
I'm sure someone had a good reason for this, but I must admit it's evading me at the moment. I guess so long as I know, I can work around it. Would have been useful to put that warning into the screen you can create a category from though. Thanks for the help.
I'm damn sure they did :D
If I remember I'll change the installer/upgrader and add a message to the categories screen/error to clarify things ;)
¥
OK, a bit more information on this one. I tried creating a new category directly into MySQL with the following results:
Firstly, an error message suggesting much as I get inside the blog
http://farm4.static.flickr.com/3234/3104153397_9924577e03_o.jpg
Then when I look at the table records, I see this
http://farm4.static.flickr.com/3109/3104156039_d3888cd09c_o.jpg
So despite the message, it has actually created the record. Progress of a sort, but nothing seems to have changed in the back office. The new category is though showing up inside the blog.