Page 1 of 1

[Solved] Hyphen in file alias

Posted: Mon May 06, 2013 12:55 pm
by Andrew Prior
[Solved - see Calguy's post] I have just upgraded to 1.11.6
During testing I noticed some urls suddenly were broken.
What I have discovered is that previously (1.10.3) if you choose a menu name like Fred - Children the page alias was auto set to
Fred---Children. But now, if you choose that menu title the alias it is set to Fred-Children, which is much tidier.

The problem is that if you edit a prexisting page which has the alias Fred---children, say to correct a typo, then it is re-saved as Fred-children. I cannot manually force it to save the original alias.

I am dealing with a site where there are hundreds of pages which have this menu style, so the issue has huge potential. I thought that if I had to change a page I would then run a link checker to see where other links to the page were then broken; the site is heavily cross linked. But I realise that as soon as I correct a page, that page's alias is also changed, causing a spiralling increase in the number of errors.

Is there any remote chance of stopping this feature on this site?

Re: Hyphen in file alias

Posted: Mon May 06, 2013 3:30 pm
by calguy1000
Though CMSMS shouldn't be re-changing an alias after one exists, you can remove this cleanup code.

in lib/misc.functions.php in the function munge_string_to_url look for this code:

for( $i = 0; $i < 5; $i++ ) {
$tmp = str_replace('--','-',$alias);
if( $tmp == $alias ) break;
$alias = $tmp;
}

Re: Hyphen in file alias

Posted: Mon May 06, 2013 4:26 pm
by Wishbone
Hope the moderators don't delete your post because of suggesting core modifications. :)

Re: Hyphen in file alias

Posted: Mon May 06, 2013 4:55 pm
by calguy1000
Call it 'executive privilege' :)

Re: Hyphen in file alias

Posted: Tue May 07, 2013 12:16 am
by Andrew Prior
Calguy, thanks so much.
I rather suspect you might have already done this, but should I put in a bug report.? Andrew

ps. Just tested. It works.