Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,15 @@ public function announceOptions() {
/**
* Create or update a discussion.
*
* @param string $categoryUrlCode
* @param bool $announce Used for a new discussion only,
* https://github.com/topcoder-platform/forums/issues/444
* @throws Gdn_UserException
* @since 2.0.0
* @access public
*
* @param int $categoryID Unique ID of the category to add the discussion to.
*/
public function discussion($categoryUrlCode = '') {
public function discussion($categoryUrlCode = '', $announce = '') {
// Override CategoryID if categories are disabled
$useCategories = $this->ShowCategorySelector = (bool)c('Vanilla.Categories.Use');
if (!$useCategories) {
Expand Down Expand Up @@ -185,6 +188,9 @@ public function discussion($categoryUrlCode = '') {
$this->Form->removeFormValue('DiscussionID');
// Make sure a group discussion doesn't get announced outside the groups category.
$formAnnounce = $this->Form->_FormValues['Announce'];
if($announce && $announce == 1) {
$this->Form->setFormValue('Announce', '2'); // Announce in a category only
}
// if (isset($formAnnounce) && $formAnnounce === '1') {
// if (isset($this->Data['Group'])) {
// $this->Form->setFormValue('Announce', '2');
Expand Down