When a specific function is called within the Questions / Polls plugin, I would like to execute an SQL query.
The function is the following:
public function addOption( $questionId, $userId, $text, $time = null )
{
$option = new QUESTIONS_BOL_Option();
$option->questionId = (int) $questionId;
$option->text = $text;
$option->userId = (int) $userId;
$option->timeStamp = empty($time) ? time() : $time;
$this->optionDao->save($option);
OW::getEventManager()->trigger( new OW_Event(self::EVENT_OPTION_ADDED, array(
'questionId' => $questionId,
'text' => $text,
'userId' => $userId,
'id' => $option->id
)));
return $option;
}
What I would like is to execute the following query:
$query = 'UPDATE `ow_questions_activity` SET `timeStamp` = time() WHERE `activityId` = ' . $questionId;
$result = mysql_query($query) or die ("Cannot execute query: $query");
I've tried to add this query after the function but it never works...
Why can't I simply add this query to the current function?
How should I proceed to execute this query whenever this function is called?
Thank you very much for your help and support!