/** creates a new social group * * @param mixed array which must include parentid, title. Should also have various options and a description. * * @return int nodeid of the created group/channel */ public function createSocialGroup($input) { if (empty($input['parentid'])) { throw new vB_Exception_Api('invalid_sg_parent'); } $sgParent = intval($input['parentid']); $catNode = vB_Api::instanceInternal('node')->getNode($sgParent); if (empty($catNode) or $catNode['parentid'] != $this->getSGChannel()) { throw new vB_Exception_Api('invalid_sg_parent'); } // Check for the permissions $check = vB_Api::instanceInternal('content_channel')->canAddChannel($this->getSGChannel()); if (!$check['can'] and $check['exceeded']) { throw new vB_Exception_Api('you_can_only_create_x_groups_delete', array($check['exceeded'])); } // social group type, we allow post by default while creating social group $input['nodeoptions'] = 2; switch ($input['group_type']) { case 2: $input['nodeoptions'] |= vB_Api_Node::OPTION_NODE_INVITEONLY; break; case 1: break; default: $input['nodeoptions'] |= vB_Api_Node::OPTION_AUTOAPPROVE_MEMBERSHIP; break; } return $this->createChannel($input, $sgParent, vB_Page::getSGConversPageTemplate(), vB_Page::getSGChannelPageTemplate(), vB_Api_UserGroup::CHANNEL_OWNER_SYSGROUPID); }