Index: openacs-4/packages/forums/lib/forums/new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/new.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/forums/lib/forums/new.tcl 27 Sep 2017 11:07:52 -0000 1.8 +++ openacs-4/packages/forums/lib/forums/new.tcl 8 Nov 2017 12:05:55 -0000 1.9 @@ -26,23 +26,22 @@ if {[form is_valid forum]} { template::form get_values forum \ - forum_id name charter presentation_type posting_policy new_threads_p + forum_id name charter presentation_type posting_policy new_threads_p anonymous_allowed_p - set forum_id [forum::new -forum_id $forum_id \ - -name $name \ - -charter [template::util::richtext::get_property contents $charter] \ - -presentation_type $presentation_type \ - -posting_policy $posting_policy \ - -package_id $package_id \ - ] - # Users can create new threads? - if { $new_threads_p && $posting_policy ne "closed" } { - forum::new_questions_allow -forum_id $forum_id - } else { - forum::new_questions_deny -forum_id $forum_id - } + set new_questions_allowed_p [expr {$new_threads_p && $posting_policy ne "closed" ? t : f}] + db_transaction { + set forum_id [forum::new -forum_id $forum_id \ + -name $name \ + -charter [template::util::richtext::get_property contents $charter] \ + -presentation_type $presentation_type \ + -posting_policy $posting_policy \ + -package_id $package_id \ + -new_questions_allowed_p $new_questions_allowed_p \ + -anonymous_allowed_p $anonymous_allowed_p] + } + ad_returnredirect $return_url ad_script_abort } @@ -51,12 +50,13 @@ # Pre-fetch the forum_id set forum_id [db_nextval acs_object_id_seq] element set_properties forum forum_id -value $forum_id - element set_value forum new_threads_p 1 + element set_value forum new_threads_p t + element set_value forum anonymous_allowed_p f element set_value forum name $name } -if {([info exists alt_template] && $alt_template ne "")} { - ad_return_template $alt_template +if {[info exists alt_template] && $alt_template ne ""} { + ad_return_template $alt_template } # Local variables: