Page 1 of 1
Limit the number of open tickets
Posted: Thu Jul 22, 2010 1:54 am
by SupportCenter
I'd like to know how to prevent users from opening multiple tickets. I've already tried this and it doesnt seem to work. I was able to open multiple tickets and have seen others do so. I've changed all the 3's to 1's and then 2's nothing seems to work.
1. Paste the following below the hesk_dbConnect(); in the submit_ticket.php
$sql = "SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `status` != '3' AND (`email` LIKE '".hesk_dbEscape($email)."' OR `ip` LIKE '".hesk_dbEscape($_SERVER['REMOTE_ADDR'])."')";
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res) >= 3)
{
hesk_error("You can have maximum 3 open tickets at a time!");
}
Paste it just below: Code:
hesk_dbConnect();
2. To limit the number of tickets to one change all the 3's to 1's
Posted: Thu Jul 22, 2010 6:16 am
by Klemen
What version are you using?
Posted: Thu Jul 22, 2010 6:27 am
by SupportCenter
Im using the version prior to the new release.
Posted: Thu Jul 22, 2010 6:58 pm
by Klemen
I just tested version 2.1 and this code works fine for me - it doesn't allow more than 3 open tickets. Just make 100% sure you paste it BELOW hesk_dbConnect();
Code: Select all
$sql = "SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `status` != '3' AND (`email` LIKE '".hesk_dbEscape($email)."' OR `ip` LIKE '".hesk_dbEscape($_SERVER['REMOTE_ADDR'])."')";
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res) > 2)
{
hesk_error("You can have maximum 3 open tickets at a time!");
}
Posted: Thu Jul 22, 2010 10:11 pm
by SupportCenter
it is located below that file. I thought it worked before checked thee tickets and they were still able to open a new ticket.
Posted: Fri Jul 23, 2010 6:28 am
by Klemen
Yes, but they probably used a different e-mail address? Or they re-opened a ticket that was already closed in the past?
Posted: Fri Aug 13, 2010 4:41 am
by SupportCenter
No they are entering the same exact information as before. Today I had two people reopen tickets that had one waiting for reply. There has to be a different way where you can block them by IP. I did the code exactly and it doesnt work.
Posted: Fri Aug 13, 2010 5:01 am
by SupportCenter
$sql = "SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `status` != '2' AND (`email` LIKE '".hesk_dbEscape($email)."' OR `ip` LIKE '".hesk_dbEscape($_SERVER['REMOTE_ADDR'])."')";
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res) >= 1)
{
hesk_error("You can have maximum 1 open tickets at a time!");
}
THIS IS THE CORRECT CODE
Posted: Fri Aug 13, 2010 2:29 pm
by Klemen
Wait, wait, this is the first time you made sense now - you are talking about reopening tickets now, not opening new ones!
If you want to prevent them to REopen more than XY tickets you will need to add the same ticket checking code into the change_status.php file i n line 65, just above:
$status = 1;