Index: openacs-4/packages/forums/lib/message/thread-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/thread-chunk.tcl,v diff -u -N -r1.15 -r1.15.2.1 --- openacs-4/packages/forums/lib/message/thread-chunk.tcl 15 Jun 2018 19:59:03 -0000 1.15 +++ openacs-4/packages/forums/lib/message/thread-chunk.tcl 19 Jun 2019 15:59:27 -0000 1.15.2.1 @@ -21,7 +21,7 @@ set forum_id $message(forum_id) set tree_sortkey $message(tree_sortkey) -if {[forum::attachments_enabled_p]} { +if {[forum::attachments_enabled_p -forum_id $forum_id]} { set query select_message_responses_attachments } else { set query select_message_responses Index: openacs-4/packages/forums/tcl/forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-procs.tcl,v diff -u -N -r1.38 -r1.38.2.1 --- openacs-4/packages/forums/tcl/forums-procs.tcl 21 Dec 2018 14:53:27 -0000 1.38 +++ openacs-4/packages/forums/tcl/forums-procs.tcl 19 Jun 2019 15:59:27 -0000 1.38.2.1 @@ -92,7 +92,17 @@ -forum_id $forum_id } -ad_proc -public forum::attachments_enabled_p {} { +ad_proc -public forum::attachments_enabled_p { + {-forum_id ""} +} { + Check if attachments are enabled in forums. + + If 'forum_id' is not passed, check only if the attachments package is + mounted as a child of the current forums package instance. + + Otherwise, check also if a particular forum's 'attachments_allowed_p' option + is true. In case the package is mounted and the option enabled, return 1. + @return 1 if the attachments are enabled in the forums, 0 otherwise. } { if {"forums" eq [ad_conn package_key]} { @@ -101,6 +111,13 @@ } else { set return_value 0 } + + if {$return_value && $forum_id ne ""} { + forum::get -forum_id $forum_id -array forum + if {! $forum(attachments_allowed_p)} { + set return_value 0 + } + } return $return_value } Index: openacs-4/packages/forums/www/message-post.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-post.tcl,v diff -u -N -r1.48 -r1.48.2.1 --- openacs-4/packages/forums/www/message-post.tcl 7 Jun 2018 18:08:11 -0000 1.48 +++ openacs-4/packages/forums/www/message-post.tcl 19 Jun 2019 15:59:27 -0000 1.48.2.1 @@ -75,9 +75,11 @@ && ($parent_id eq "" || [forum::security::can_post_forum_p \ -forum_id $parent_message(forum_id) -user_id 0])}] +if {$forum_id eq ""} { + set forum_id $parent_message(forum_id) +} +set attachments_enabled_p [forum::attachments_enabled_p -forum_id $forum_id] -set attachments_enabled_p [forum::attachments_enabled_p] - ############################## # Template variables #