We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28589
    • 56 Posts
    Hello,

    I’m not sure whether this is a known/confirmed bug, but better safe than sorry.

    If I make a page called "Test", its alias will automatically be "test". If I make another such page, the alias will be "test1". However, if I make one more, its alias will be "test1" again, rather than "test2". Going to the test1 one URL will then show the oldest page with this alias, and the new ones can’t be accessed unless you change the alias manually to something else.
    The option to prevent alias dupes doesn’t prevent this. It only shows a warning if I try to resave one of the pages that already has duplicate aliases.
    This is a rather problematic issue for us, as we post RSS articles that tend to have the same titles...

    Any news or quick patch for this issue?

    On a side note, I also noticed QuickEdit issues (namely: it messes up accents, and shows just a blank popup if the page is locked due to modifications by another user), but I think those bugs have been around for a while...
    • The option to prevent alias dupes doesn’t prevent this.
      This has been fixed and will be in the next MODx release. Or, if you wanted to view the patch: http://svn.modxcms.com/crucible/changelog/modx?cs=4118
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 28589
        • 56 Posts
        Thank you!

        I got it to work. smiley
        Weirdly, the patch in the bug fix you linked to doesn’t work (because of missing single quotes around the $id variables).
        I checked out the concerned file in the SVN, copied the concerned lines (the if block that starts below "// auto assign alias"), and that worked fine. Maybe there was a follow-up bug regarding the missing single quotes, or something. *shrugs*
        • Oops! Just to confirm that the single quotes are present in the latest SVN head revision so the patch will work fine in the next release - looks like I missed them out in that commit but added them in on the next commit to that file, most likely a stupid copy/paste slip on my behalf.
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 4225
            • 7 Posts
            Hi,

            As far as I can tell, If ’allow duplicate aliases’ is turned on, then duplicates are allowed, even among ’sibling’ documents. It seems to me that this still creates a conflict for URL re writing. Does this patch still need some work? Something like this maybe?

            	// auto assign alias
            	if (!$alias && $automatic_alias) {
            		$alias = strtolower(stripAlias(trim($pagetitle)));
            		if(!$allow_duplicate_alias) {
            			if ($modx->db->getValue("SELECT count(id) FROM " . $tbl_site_content . " WHERE id<>$id AND alias='$alias'") != 0) {
            				$cnt = 1;
            				$tempAlias = $alias;
            				while ($modx->db->getValue("SELECT count(id) FROM " . $tbl_site_content . " WHERE id<>$id AND alias='$tempAlias'") != 0) {
            					$tempAlias = $alias;
            					$tempAlias .= $cnt;
            					$cnt++;
            				}
            				$alias = $tempAlias;
            			}
            		}
            		else {
            			if ($modx->db->getValue("SELECT id FROM " . $tbl_site_content . " WHERE id<>'$id' AND alias='$alias' AND parent='$parent'") != 0) {
            				$cnt = 1;
            				$tempAlias = $alias;
            				while ($modx->db->getValue("SELECT count(id) FROM " . $tbl_site_content . " WHERE id<>$id AND alias='$tempAlias' AND parent='$parent'") != 0) {
            					$tempAlias = $alias;
            					$tempAlias .= $cnt;
            					$cnt++;
            				}
            				$alias = $tempAlias;
            			}
            		
            		}
            	}


            Ben