Latest Register Log In

+ Advanced Search

Require Unique Title

Require Unique Title
By
04/13/11 (Edited 02/03/14)

This hack will refuse to allow people to submit (or edit) a article with the same title as another article in the directory.
Save the following code to a uniquetitle.php file and upload it to your /plugins/ subdirectory:
<?php
function checkincompletes(&$object)
{
global $incomplete, $incompletemessage, $db;
if ($object->objecttype == 'link')
{
if ($object->id) $idbit = " AND id != '{$object->id}'"; else $idbit = "";
$existing = $db->selectcount('linkstable', "deleted=0 AND title='".encodeit($object->title)."' $idbit");
if (($object->id && $existing > 1) || (!$object->id && $existing)) { $incomplete = true; $incompletemessage[] = "The title {$object->title} is already in use by another article. Each article must have a unique title. Please choose another title."; }
}
return true;
}
?>




Description A plugin to make sure all article titles are unique.
Rating
Views 232 views. Averaging 0 views per day.