Hi I found 3 error on in object action, and add 1 little feature.
TIME CREATION
In some condition, if the Joomla installation is set to a timezone and the user is set to another the article published isnt visible until UTC time pass virtual user time.
The solution is to patch line 26:
with:
LANGUAGE
Another patch required, is to add somewhere a line:
because if the joomla installation had a language filter active, new submitted articles is not show.
[DEFAULT_CREATOR]
Than I applied another feature that permit to choice a user for publish articles from guest users:
I Add this lines at submit_article.ctp at line 15:
at line 45:
and to submit_article.php at line 30: (after other patch for correct timing of article)
Unique article alias
I discover that on sending an article with the action can be create more than one article with same alias, this condition can be a disaster for SEF of a website, this few lines solve the problem.
I place on my webserver patched files (zip form) at this url: http://www.sfs.it/downloads/submit_article.zip
Zipped files can be used to update standard action present into Chronoforms installation.
--
Agostino Zanutto
SFS.it
TIME CREATION
In some condition, if the Joomla installation is set to a timezone and the user is set to another the article published isnt visible until UTC time pass virtual user time.
The solution is to patch line 26:
$form->data['created'] = $date->format('Y-m-d H:i:s', false, false); // date("Y-m-d H:i:s");
with:
$user =& JFactory::getUser();
$date = new JDate($myDate, $user->getParam('timezone')?JFactory::getConfig()->getValue('offset'):0);
$form->data['created'] = $date->format('Y-m-d H:i:s', false, false); // date("Y-m-d H:i:s");
LANGUAGE
Another patch required, is to add somewhere a line:
$form->data['language'] = '*';
because if the joomla installation had a language filter active, new submitted articles is not show.
[DEFAULT_CREATOR]
Than I applied another feature that permit to choice a user for publish articles from guest users:
I Add this lines at submit_article.ctp at line 15:
<input type="hidden" name="chronoaction[{n}][action_submit_article_{n}_default_created_by]" id="action_submit_article_{n}_default_created_by" value="<?php echo $action_params['default_created_by']; ?>" />
at line 45:
<?php
$database =& JFactory::getDBO();
$query = "SELECT * FROM `#__users`";
$database->setQuery($query);
$options = array();
$users = $database->loadObjectList();
foreach($users as $user){
$options[$user->id] = $user->name;
}
?>
<?php echo $HtmlHelper->input('action_submit_article_{n}_default_created_by_config', array('type' => 'select', 'label' => 'Default Author (if none logged in)', 'options' => $options, 'empty' => " - ", 'class' => 'medium_input', 'smalldesc' => "Select the article's default author in users.")); ?>
and to submit_article.php at line 30: (after other patch for correct timing of article)
$form->data['created_by'] = ($user->guest)?$params->get('default_created_by', ''):$user->id;
Unique article alias
I discover that on sending an article with the action can be create more than one article with same alias, this condition can be a disaster for SEF of a website, this few lines solve the problem.
$database =& JFactory::getDBO();
$alias = JFilterOutput::stringURLSafe($form->data['title']);
$n=2;
do {
$query = "SELECT * FROM `#__content` WHERE alias = '{$form->data['alias']}'";
$database->setQuery($query);
$articles = $database->loadObjectList();
if (!empty($articles)) {
$form->data['alias']=$alias.'-'.$n;
$n++;
}
} while (!empty($articles));
I place on my webserver patched files (zip form) at this url: http://www.sfs.it/downloads/submit_article.zip
Zipped files can be used to update standard action present into Chronoforms installation.
--
Agostino Zanutto
SFS.it