-
Notifications
You must be signed in to change notification settings - Fork 300
Custom chat channels
Doc gWorldz edited this page Jul 17, 2014
·
5 revisions
If you're using the standalone version you can directly edit the list of available channels. For more information please read Choose Your Channel Settings in the Installation section of the readme.html included.
The forum integration versions of AJAX Chat take over the forums as chat channels:
- The forum's name is used as the channel name (whitespace is replaced with the underscore "_")
- The forum's ID is used as the channel ID
- The forum's access restriction is taken over for the channel access restriction
If you don't want to use all your forums as channels, you can limit the used forums with a configuration option in lib/config.php:
// Defines an array of channelIDs (e.g. array(0, 1)) to limit the number of available channels, will be ignored if set to null: $config['limitChannelList'] = array(123,456,789);This setting would only use the forums with the IDs 123, 456 and 789 as channels.
To add additional custom chat channels which are not taken from the forums you have to adjust the methods getChannels() and getAllChannels() in lib/class/CustomAJAXChat.php:
- The method getAllChannels() returns an array of all available channels, no matter if the current user has access to these channels or not.
- The method getChannels() returns and array of channels to which the current user has access to.
$channels = array('Extra_Public_Channel_1'=>123, 'Extra_Public_Channel_2'=>456, 'Extra_Public_Channel_3'=>789);Note: The channelNames may not contain any whitespace.
To add these channels as custom chat channels, do one of the following:
- Add additional channels individually with an array
- Add additional channels using lib/class/data/channels.php
Add
$this->_channels = array_merge($this->_channels, array('Extra_Public_Channel_1'=>123, 'Extra_Public_Channel_2'=>456, 'Extra_Public_Channel_3'=>789));before
} return $this->_channels;
Add
$this->_allChannels = array_merge($this->_allChannels, array('Extra_Public_Channel_1'=>123, 'Extra_Public_Channel_2'=>456, 'Extra_Public_Channel_3'=>789));before
} return $this->_allChannels;Note: This setting would add these channels as public channels accessible for all chat users. To restrict access to such a custom channel you would have to add your own custom conditions before adding the custom channels inside the method getChannels().
Add
$this->_channels = array_merge($this->_channels, $this->getCustomChannels());Before
} return $this->_channels;
Add
$this->_allChannels = array_merge($this->_allChannels, $this->getCustomChannels());Before
} return $this->_allChannels;Note: This setting would add all channels from lib/class/data/channels.php as public channels accessible for all chat users. To restrict access to such a custom channel you would have to add your own custom conditions before adding the custom channels inside the method getChannels().