Hi,
I'm not sure if anyone has provided a solution for duplicate submission checking, but I've put together this basic one if its of any use.
It checks the URL from the add form, but only for an exact match. This means that if a user puts something on the end of the original URL, such as "index.html" this check won't catch it.
Anyway here goes:
Firstly, create an error message in 'Build > User Language > Add' called ADD_DUP. The message will need to be generic since duplicates caught can be both validated or unvalidated. Maybe something like "'%s' has already been suggested to us, thank you".
Then, add the following to Add.pm above # Add the record.:
my $chk_dup = $db->count ( { URL => $IN->param('URL') } );
if ($chk_dup) {
print Links::SiteHTML::display('error', { error => Links::language('ADD_DUP', $IN->param('URL')) });
return;
}
That's it.
As I've said, its only basic - maybe someone could enhance it by adding an 'IsValidated' check to give a more specific error report.
Note: It also uses the general 'error.html' template, as opposed to continually displaying the error in the 'Add' form.
Hope it helps.
All the best
Shaun
I'm not sure if anyone has provided a solution for duplicate submission checking, but I've put together this basic one if its of any use.
It checks the URL from the add form, but only for an exact match. This means that if a user puts something on the end of the original URL, such as "index.html" this check won't catch it.
Anyway here goes:
Firstly, create an error message in 'Build > User Language > Add' called ADD_DUP. The message will need to be generic since duplicates caught can be both validated or unvalidated. Maybe something like "'%s' has already been suggested to us, thank you".
Then, add the following to Add.pm above # Add the record.:
Code:
# Check that the URL isn't already in the Links database my $chk_dup = $db->count ( { URL => $IN->param('URL') } );
if ($chk_dup) {
print Links::SiteHTML::display('error', { error => Links::language('ADD_DUP', $IN->param('URL')) });
return;
}
That's it.
As I've said, its only basic - maybe someone could enhance it by adding an 'IsValidated' check to give a more specific error report.
Note: It also uses the general 'error.html' template, as opposed to continually displaying the error in the 'Add' form.
Hope it helps.
All the best
Shaun