Skip to content

Commit 275f87b

Browse files
committed
Issues-444: create announcement in a category
1 parent 106b299 commit 275f87b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

vanilla/applications/vanilla/controllers/class.postcontroller.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,15 @@ public function announceOptions() {
106106
/**
107107
* Create or update a discussion.
108108
*
109+
* @param string $categoryUrlCode
110+
* @param bool $announce Used for a new discussion only,
111+
* https://github.com/topcoder-platform/forums/issues/444
112+
* @throws Gdn_UserException
109113
* @since 2.0.0
110114
* @access public
111115
*
112-
* @param int $categoryID Unique ID of the category to add the discussion to.
113116
*/
114-
public function discussion($categoryUrlCode = '') {
117+
public function discussion($categoryUrlCode = '', $announce = '') {
115118
// Override CategoryID if categories are disabled
116119
$useCategories = $this->ShowCategorySelector = (bool)c('Vanilla.Categories.Use');
117120
if (!$useCategories) {
@@ -185,6 +188,9 @@ public function discussion($categoryUrlCode = '') {
185188
$this->Form->removeFormValue('DiscussionID');
186189
// Make sure a group discussion doesn't get announced outside the groups category.
187190
$formAnnounce = $this->Form->_FormValues['Announce'];
191+
if($announce && $announce == 1) {
192+
$this->Form->setFormValue('Announce', '2'); // Announce in a category only
193+
}
188194
// if (isset($formAnnounce) && $formAnnounce === '1') {
189195
// if (isset($this->Data['Group'])) {
190196
// $this->Form->setFormValue('Announce', '2');

0 commit comments

Comments
 (0)