Perfect, so i have managed to to make this a multi select. Now i am trying to make it so that when u select multiple categories that duplicate posts are created and one is assigned to each category.
So what I have tried to do is pass the multi select and the perform a submit for each item in the multiselect using a loop as the bottom of the below but it doesn't seem to be working. Could you point me in the right direction here?
public function submit()
{
JRequest::checkToken('request') or jexit( 'Invalid Token' );
$config = DiscussHelper::getConfig();
$my = JFactory::getUser();
$app = JFactory::getApplication();
$acl = DiscussHelper::getHelper( 'ACL' );
// If guest posting is disallowed in the settings, they shouldn't be able to create a discussion at all.
if( !$my->id && !$acl->allowed('add_question', '0') )
{
DiscussHelper::setMessageQueue( JText::_('COM_EASYDISCUSS_POST_PLEASE_LOGIN' ) , DISCUSS_QUEUE_ERROR );
$app->redirect( DiscussRouter::_('index.php?option=com_easydiscuss' , false ) );
return $app->close();
}
// If user is disallowed in the acl, they shouldn't be able to create a discussion at all.
if( $my->id && !$acl->allowed('add_question', '0') )
{
DiscussHelper::setMessageQueue( JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS' ) , DISCUSS_QUEUE_ERROR );
$app->redirect( DiscussRouter::_('index.php?option=com_easydiscuss' , false ) );
return $app->close();
}
// Get values from the posted form.
$data = JRequest::get( 'post' );
if( isset( $data['mod_post_topic_category_id'] ) )
{
$data['category_multi'] = $data['mod_post_topic_category_id'];
unset( $data['mod_post_topic_category_id'] );
}
//New loop to get the categories
foreach ($category_multi as $category_id){
// Run validation on the posted data.
if(! $this->_fieldValidate($data))