In this article we will talk about the methods used for manipulating Discussions in your activeCollab.

1. Fetching a discussion

object ActiveCollab::findDiscussionById(int $project_id, int $discussion_id) - Fetches an ActiveCollabDiscussion object

Parameters:

project_id - id of a project which the Discussion is in discussion_id - id of a specific discussion

Return value: Object instance of ActiveCollabDiscussion

2. Creating a new discussion

object $discussion = new ActiveCollabDiscussion(int $project_id) - Creates a new ActiveCollabDiscussion object

Parameters:

project_id - id of a project in which the discussion is going to be created

Variable value: Object instance of ActiveCollabDiscussion

3. Editing and saving a discussion

These methods are called out through an discussion object.

•   setCreatedByEmail(string $email)  -  Sets an email of the user who created this discussion
•   setCreatedByName(string $name)  -  Sets the name of the user who created this discussion
•   setName(string $name)  -  Sets the name of this discussion
•   setBody(string $body)  -  Sets the description of this discussion
•   setTags(array of string $tagArr) - Sets tags for this discussion
•   setVisibility(int $visibility) - Sets the visibility of this discussion; the visibility parameter can be a combination of the following constants: ACTIVECOLLAB_VISIBILITY_PRIVATE, ACTIVECOLLAB_VISIBILITY_NORMAL
•   setParentId(int $parent_id) - Sets the parent for this discussion
•   setMilestoneId(int $milestone_id) - Sets the milestone for this discussion
•   addAttachments(array of file $arr_files) - Adds array of files to a discussion
•   save(void) - Saves the discussion object into activeCollab