*
* @param string The name of the forum.
* @param string The description of the forum.
- * @param int Pass (1) if it should be public (0) for private.
* @param string The email address to send all new posts to.
* @param int Pass (1) if a welcome message should be created (0) for no welcome message.
- * @param int Pass (1) if we should allow non-logged-in users to post (0) for mandatory login.
- * @param int Pass (0) if the messages that are posted in the forum should go to moderation before available. 0-> no moderation 1-> moderation for anonymous and non-project members 2-> moderation for everyone
* @return boolean success.
*/
- function create($forum_name,$description,$is_public=1,$send_all_posts_to='',$create_default_message=1,$allow_anonymous=1,$moderation_level=0) {
+ function create($forum_name,$description,$send_all_posts_to='',$create_default_message=1) {
- if (strlen($forum_name) < 3) {
+ if (!$this->is_news && strlen($forum_name) < 3) {
$this->setError(_('Forum Name Must Be At Least 3 Characters'));
return false;
}
if ($group_id) {
$this->group_id = $group_id;
$this->g = group_get_object($group_id);
- $this->p =& $this->g->getPermission ();
+ $this->p =& $this->g->getPermission();
+ if (!$this->g->usesForum()) {
+ $this->setError(sprintf(_('%s does not use the Forum tool'),
+ $this->g->getPublicName()));
+ return false;
+ }
}
}
*/
db_begin();
- $f = new Forum($group);
+ $f = new Forum($group, false, false, true);
- if (!$f->create(preg_replace('/[^_\.0-9a-z-]/','-', strtolower($summary)),$details,1,'',0,0)) {
+ if (!$f->create(preg_replace('/[^_\.0-9a-z-]/','-', strtolower($summary)),$details,'')) {
db_rollback();
exit_error($f->getErrorMessage(),'news');
}