Duplicate URLs

From The Lyceum Wiki

Jump to: navigation, search

NOTE: this is fixed in 0.32 and later

I was having a problem where people could change the URL slug of their site to the same slug that another user was already using. Adding the following code to options.php took care of the problem:

Find this line:

$wpdb->query("UPDATE $wpdb->blogs SET slug = '$slug' WHERE id = '$blogdata->id'");

Above it add this:

$slugcheck = $wpdb->get_var("SELECT slug FROM $wpdb->blogs WHERE slug = '$slug'");
if ($slugcheck) {
    die ("URL in use, please go back and choose another");
}
Personal tools