I have joomla version 1.15.26. I have used AcePolls components http://www.joomace.net/downloads/acepolls/acepolls-for-joomla-15
In my index.php I have code like :
<jdoc:include type="message" />
<jdoc:include type="component" />
My problem is that when I vote for poll the message from controller, not displaying on same page. But when I visit other page, this message is there.
I couldn't find where it the problem, as in my localhost it's working fine, but on live server it's not working properly.
As I understand system messages are stored as in queue in joomla. But here it's queuing but displaying on another reload (not on same page reload, on other page visit).
My controller:
function vote() {
$mainframe = JFactory::getApplication();
$poll_id = JRequest::getInt('id', 0);
$option_id = JRequest::getInt('voteid', 0);
$poll =& JTable::getInstance('Poll', 'Table');
$item_id = JRequest::getInt('itemid');
if (!$poll->load($poll_id) || $poll->published != 1) {
JError::raiseWarning(404, JText::_('ALERTNOTAUTH'));
return;
}
$cookieName = JUtility::getHash($mainframe->getName().'poll'.$poll_id);
$voted = JRequest::getVar($cookieName, '0', 'COOKIE', 'INT');
if ($voted || !$option_id) {
if ($voted) {
$msg = JText::_('COM_ACEPOLLS_ALREADY_VOTED');
$tom = "error";
}
if (!$option_id){
$msg = JText::_('COM_ACEPOLLS_NO_SELECTED');
$tom = "error";
}
}
else {
require_once(JPATH_COMPONENT.DS.'models'.DS.'poll.php');
$model = new AcepollsModelPoll();
if ($model->vote($poll_id, $option_id)) {
//Set cookie showing that user has voted
setcookie($cookieName, '1', time() + 60*$poll->lag);
}
$msg = JText::_('COM_ACEPOLLS_THANK_YOU');
$tom = "";
if (JFactory::getUser()->id != 0) {
JPluginHelper::importPlugin('acepolls');
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger('onAfterVote', array($poll, $option_id));
}
}
// set Itemid id for links
$menu = &JSite::getMenu();
$items = $menu->getItems('link', 'index.php?option=com_acepolls');
$itemid = isset($items[0]) ? '&Itemid='.$items[0]->id : '';
if(!$itemid)
$itemid = '&Itemid='.$item_id;
$this->setRedirect(JRoute::_('index.php?option=com_acepolls&view=poll&id='. $poll_id.':'.$poll->alias.$itemid, false), $msg, $tom);
}
Let me know if any other information is required. Thanks in advance.