Weird redirect on New Question
Weird redirect on New Question
When a new question is created, saveQuestion is redirecting to a URL like:
index.php?option=com_communityanswers&view=answers&task=open&Itemid=245
For some reason, Joomla is not loading the associated modules to Itemid=245.
If I manually change the URL to:
index.php?option=com_communityanswers&view=answers&task=open&Itemid=245
It works Ok. So I'm guessing there's some bug in:
Please, let me know if it's a bug to open it.
Thanks,
Anibal
index.php?option=com_communityanswers&view=answers&task=open&Itemid=245
For some reason, Joomla is not loading the associated modules to Itemid=245.
If I manually change the URL to:
index.php?option=com_communityanswers&view=answers&task=open&Itemid=245
It works Ok. So I'm guessing there's some bug in:
function saveQuestion(){
global $option;
$app = &JFactory::getApplication();
$answersConfig = &$app->getUserState(SESSION_CONFIG);
$user = JFactory::getUser();
if($user->guest){
$redirectUrl = base64_encode("index.php?option=".$option."&view=answers&task=ask".$this->getItemId());
$link = "index.php?option=com_user&view=login";
$msg = JText::_('MSG_USER_LOGIN');
$this->setRedirect($link."&return=".$redirectUrl, $msg);
}else if(!CAuthorization::authorize($option,'create','answers','all')){
JError::raiseError( 500, JText::_('MSG_UNAUTHORISED').' Error code: 10003.' );
}else{
$view = &$this->getView('answers', 'html');
$model = &$this->getModel('answers');
if($question_id = $model->save()){
/** Do after save */
$info = JText::_('AWARD_POINTS_NEW_QUESTION');
$question = &$model->getQuestion($question_id,false,false,false);
CommunityAnswersHelper::awardPoints($user->id, 1, $question_id, $info);
CommunityAnswersHelper::streamActivity(1, $question);
/* End after save */
$link = JRoute::_("index.php?option=".$option."&view=answers&task=open".$this->getItemId(true));
$msg = JText::_('MSG_SAVE_SUCCESS');
$this->setRedirect($link, $msg);
}else{
$action = 'new_question';
$view->setModel($model, true);
$view->assignRef('action', $action);
$view->display();
}
}
}
Please, let me know if it's a bug to open it.
Thanks,
Anibal
Access to viewing replies is restricted.
Showing 4 of 4 replies
You do not have permissions for replying to this topic.