I'm trying to block certain attachments from being posted. When I make use of returning "false" in the
attachdata_presave hook I can successfully stop the file from being saved in VB. However, when I try to customize the error message shown in the browser to the end-user, it only works when I am logged in as "admin". Registered users still see the standard error message.
Here's what I have in
attachdata_presave
Code:
$bannedmatches = $this->dbobject->query_first("
SELECT COUNT(*) AS count
FROM " . TABLE_PREFIX . "banned_attachment
WHERE filehash = '" . $this->fetch_field('filehash') . "'
");
if ($bannedmatches['count'] > 0)
{
$return_value = false;
$this->error('jb_file_not_allowed_here');
}
When I'm logged in as admin and try to upload a banned attachment I see my custom error phrase in the response page.
Quote:
hippos.jpg:
This file is not allowed to be uploaded on our website.
|
When I'm logged in as a registered user and try to upload the same attachment, I see the standard error phrase.
Quote:
hippos.jpg:
Upload of file failed.
|
What am I missing? What would be the best way to set the error text here to use my own custom phrase?
Thanks for your help,
James