Jump to content

Latest Support Tickets Import on Every Page Load


deathrequest

Recommended Posts

More than often, I hate waiting for the POP Import to be done on my tickets before I can reply to a client. At those moments, I wished if somehow the import from POP could be done right now, so that I can see the new ticket/reply in my WHMCS.

 

So, every time this happens I manually call my POP Import script.

 

To resolve this issue, I created this little javascript snippet which basically checks the POP Import every time a request for the Support Tickets page is made in the Admin Area.

 

So, with this snippet, you will be sure that the tickets you are seeing in the Support Tickets area are the latest replies or the latest new tickets and that there is no lag between the Support Tickets in WHMCS and the actual emails by clients. You will not have to wait 4-5 minutes to see if there are any new tickets or replies that might be imported.

 

Add the following snippet in your header.php of the admin area template you are using (e.g. /admin/templates/v4/header.php), just before the closing head tag (</HEAD>)

 

<script type="text/javascript">
   $(document).ready(function() {ldelim}
       var pageurl = "{$smarty.server.PHP_SELF}"; var newmails = 0;
       page = pageurl.split("/"); page = page[page.length - 1];
       if (page == "supporttickets.php") {ldelim}
           $.get('../pipe/pop.php', function(data){ldelim}
               $.each(data.match(/<br>Email Count: (.*?)<hr>/g), function(i, m) {ldelim}
                   newmails = newmails + parseInt(m.match(/\d/));
               {rdelim})
               if (newmails) window.location = pageurl;
           {rdelim});
       {rdelim}
   {rdelim});
</script>

 

Regards

Nikhil Gupta,

Wicked Developers

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated