Update New Feature: Blinking indication when ticket has been updated.
Master Code has been updated with this new feature. If you have installed the support script already. Use the steps below to add this feature to your existing code. If you have not installed the support system yet. Then you dont need to do these steps, the script has already been updated to include this feature.
Step 1a. Open includes/page_header.php
Find A Remove:
"lang_support_view" => $lang['support_view'],
Step 1b.
Find:
$total_categories = $data['total_categories'];
$auth_cat_sql['auth_viewcat']['IN'] = $data['auth_viewcat']['IN'];
$auth_cat_sql['auth_viewcat']['NOTIN'] = $data['auth_viewcat']['NOTIN'];
}
Paste After:
$url_support_check_ticket = "";
if(new_ticket_check($user_info['user_id'],$user_info['user_name'])){
$url_support_check_ticket .= "<script language=\"JavaScript\">\n<!--\n var flg2=0;\n function new_tick_blink(){\n var myElement=document.getElementById('blnk2');\n flg2^=1;\n if(flg2==1){\n myElement.style.visibility='hidden';\n }\n else{\n myElement.style.visibility='visible';\n }\n timerID = setTimeout( 'new_tick_blink()' , 500 );\n }\n //-->\n</script>\n";
$url_support_check_ticket .= "<span id=\"blnk2\"><a href=\"".$site_sess->url(ROOT_PATH."support.php")."\">".$lang['support_view']."</a></span></a><script language=\"JavaScript\">new_tick_blink();</script>";
}
Step 1c.
Find
"url_support_ticket" => (!empty($url_support_ticket)) ? $site_sess->url($url_support_ticket) : $site_sess->url(ROOT_PATH."support.php"),
Replace with:
"url_support_ticket" => (!empty($url_support_check_ticket)) ? $site_sess->url($url_support_check_ticket) : "<a href=\"".$site_sess->url(ROOT_PATH."support.php")."\">".$lang['support_view']."</a>",
Step 2. Open /template/YOUR TEMPLATE/user_logininfo.html
Find:
» <a href="{url_support_ticket}">{lang_support_view}</a><br />
Replace with:
» {url_support_ticket}<br />
Step 3a. Open includes/functions.php
Find:
function post_ticket($id="",$status="",$subject="none",$message="none",$priority="low",$catagory="none",$attachment="") {
global $user_info, $site_db, $session_info, $config;
$user_info_id = "";
$current_time = "";
$user_name = $user_info['user_name'];
$user_info_id = $user_info['user_id'];
if($id==""){$current_time = time();}
if($config['trouble_ticket_ip_log'] && $user_info['user_level'] != ADMIN){$ip_info=$session_info['session_ip'];}
else{$ip_info="";}
$sql = "INSERT INTO ".SUPPORT_TABLE." (`id` ,`status` ,`create_date` ,`last_update` ,`user_id` ,`catagory` ,`message` ,`priority` ,`ip`,`attachment`,`last_reply`,`subject`,`reply_id`)
VALUES('','$status','$current_time','".time()."','$user_info_id','$catagory','$message','$priority','$ip_info','$attachment','$user_name','$subject','$id')";
if ($site_db->query($sql)) {
if ($id=="") {return true;}
else{
$sql = "UPDATE ".SUPPORT_TABLE."
SET last_update = ".time()." , last_reply = '".$user_info['user_name']."'
WHERE id = $id";
if ($site_db->query($sql)){return true;}
else{return false;}
}
}
else{return false;}
}
Replace with:
function post_ticket($id="",$status="",$subject="none",$message="none",$priority="low",$catagory="none",$attachment="") {
global $user_info, $site_db, $session_info, $config;
$user_info_id = "";
$current_time = "";
$user_name = $user_info['user_name'];
$user_info_id = $user_info['user_id'];
if($id==$user_info['user_name']){$current_time = time();}
if($config['trouble_ticket_ip_log'] && $user_info['user_level'] != ADMIN){$ip_info=$session_info['session_ip'];}
else{$ip_info="";}
$sql = "INSERT INTO ".SUPPORT_TABLE." (`id` ,`status` ,`create_date` ,`last_update` ,`user_id` ,`catagory` ,`message` ,`priority` ,`ip`,`attachment`,`last_reply`,`subject`,`reply_id`)
VALUES('','$status','$current_time','".time()."','$user_info_id','$catagory','$message','$priority','$ip_info','$attachment','$user_name','$subject','$id')";
if ($site_db->query($sql)) {
if ($id=="") {return true;}
else{
$sql = "UPDATE ".SUPPORT_TABLE."
SET last_update = ".time()." , last_reply = '".$user_info['user_name']."', is_read = '0'
WHERE id = $id";
if ($site_db->query($sql)){return true;}
else{return false;}
}
}
else{return false;}
}
Step 3b.
At the end, but before the ?> Paste:
function new_ticket_check($user_id,$user_name){
global $site_db;
$sql = "SELECT *
FROM ".SUPPORT_TABLE."
WHERE user_id = '$user_id' AND is_read = '0' AND last_reply != '$user_name'";
$result = $site_db->query($sql);
$num_tick = $site_db->get_numrows($result);
if($num_tick != 0){
return true;
}
else{
return false;
}
}
Step 4.
Download the files attached to this post and replace the support.php in your root directory and run the update_support.php
Now your done. Remember only do this if you have installed the support script allready. I have updated the codes and files to include this.