General > Support
cronjob to set away/offline at a certain time
(1/1)
Bert:
We currently happily use Mibew on several of our websites.
To make sure we don't accidentally leave the chat Available outside business hours, I would like to add a cronjob to automatically set the chat to Away/Offline.
I'm looking for which SQL query to use.
I've already tried using...
--- Code: ---UPDATE `operator` SET idisabled=1
--- End code ---
...but this doesn't seem to have the intended effect.
(In fact, it somehow made it impossible for me to close the chat manually...)
Which query can I run to automatically close the chat?
faf:
To mess with the system on its low level is not the best way to do the job.
However, one can take a look on this function as a starting point.
Bert:
--- Quote from: faf on January 29, 2018, 04:52:44 PM ---To mess with the system on its low level is not the best way to do the job.
--- End quote ---
Hm, good point.
--- Quote from: faf on January 29, 2018, 04:52:44 PM ---However, one can take a look on this function as a starting point.
--- End quote ---
Are you sure that function is in use, I don't see any calls to it in the code.
I think maybe I need to use notify_operator_alive()?
[Edit:]
Maybe this is a bit closer?
--- Code: ---UPDATE operator SET istatus=1,idisabled=1,dtmlastvisited=UNIX_TIMESTAMP(NOW());
--- End code ---
faf:
--- Quote from: Bert on January 30, 2018, 08:31:20 AM ---
--- Quote from: faf on January 29, 2018, 04:52:44 PM ---However, one can take a look on this function as a starting point.
--- End quote ---
Are you sure that function is in use, I don't see any calls to it in the code.
--- End quote ---
Yes, I'm sure. ;D
It's a part of the core Client-Server interaction for the Users application. It's called during the special RPC-like interaction between the client and the server. However, it's a little bit complicated matter that can be hard to explain. If you really want to understand it you should start with the docs: https://docs.mibew.org/development/core-architecture.html
--- Quote from: Bert on January 30, 2018, 08:31:20 AM ---I think maybe I need to use notify_operator_alive()?
--- End quote ---
Yes, probably you could write a plugin that utilizes the CRON_RUN event and calls this function.
--- Quote from: Bert on January 30, 2018, 08:31:20 AM ---[Edit:]
Maybe this is a bit closer?
--- Code: ---UPDATE operator SET istatus=1,idisabled=1,dtmlastvisited=UNIX_TIMESTAMP(NOW());
--- End code ---
--- End quote ---
To begin with, you don't need idisabled. You don't have to disable an operator, just alter the status. And as it was written before, bare SQL-requests is a bad idea.
Bert:
Thanks for the feedback.
In the end, I decided to go for a different approach.
I now hide the mibew button itself outside business hours.
So, during the day, they can on-/offline the button...
...and when we're closed visitors don't see the button, which means it's not an issue if an employee accidentally leaves the chat online.
Navigation
[0] Message Index
Go to full version