Latest Register Log In

+ Advanced Search

Require Unique Title

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

This hack will refuse to allow people to submit (or edit) a listing with the same title as another listing 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 listing. Each listing must have a unique title. Please choose another title."; }
}
return true;
}
?>




Description A plugin to make sure all listing titles are unique.
Rating
Views 292 views. Averaging 0 views per day.
Similar Listings