I've added a couple of small features

2008-03-11
2012-11-15
  • Jody Florian

    Jody Florian - 2008-03-11

    Alterations:
    1. Now config includes option to get channels from CATEGORIES as well as forums.
    2. Config now allows disabling of "Public" ("default") channel.
    3. Config now allows exluding of certain Categories or Forums (depending on choice of 1

    For the source please visit

    http://www.phpbb.com/community/viewtopic.php?f=46&t=823225&p=4678415#p4678415

     
    • Jody Florian

      Jody Florian - 2008-03-12

      Hiya Sebastian,

      Thanks for your response.

      The existing features came close but not quite what I needed.

      I could not figure out how to adapt changing $config['defaultChannelID'] because it had to be potentially different for each user. (I finally hacked around the problem, it was a right nightmare and I ended up having to suppress some chatbot error messages to get it working).

      $config['limitChannelList'] didn't quite do it for me because every time I were to add a category, I would have to edit the list. Whereas for me the categories I don't want appearing are quite static, the categories I wish to use as channels change often.

      Regards to deleting the lines:
      ----
      forum_type=1
      AND
      ----

      You're spot on - it's very close to what I did. However, I did not want links and forums appearing, just categories, so I created a config variable 'getChannelsFromForumType' and assigned it a value of 0.

      ----
      forum_type='.$this->getConfig('getChannelsFromForumType').'
      AND
      ----

      Although I could have just modified the lines to:
      ----
      forum_type=0
      AND
      ----

      But I thought I should keep the code style going.

       
    • Sebastian Tschan

      If you need to set defaultChannelID to a different ID for each user, you can do it by adding the following to class CustomAJAXChat:
      ---
          function initCustomSession() {
              if($this->isLoggedIn()) {
                  $some_valid_channel_id = 0; // Your code here
                  // Set the defaultChannelID depending on the logged in user:
                  $this->setConfig('defaultChannelID', 'null, $some_valid_channel_id);
              }
          }
      ---

      Just make sure that the defaultChannel is always accessible.

      Sebastian

       
    • Jody Florian

      Jody Florian - 2008-03-12

      As it turns out it doesn't work for admin... but it's the thought that counts. I didn't expect it to be bug free.

       
    • Jody Florian

      Jody Florian - 2008-03-12

      The only feature I'm having trouble removing is the Public channel... will be back soon. Help appreciated... jody dot remove this spam text florian at gmail dot com

       
    • Jody Florian

      Jody Florian - 2008-03-12

      My mistake, it does work after all. I just get confused with phpBB's permissions

       
    • Jody Florian

      Jody Florian - 2008-03-12

      Ok I'll stop flooding. But there are more bugs. Good chat program, shame about the monstrosity that is phpBB

       
    • Sebastian Tschan

      Thanks for your interest in this chat application, Jody.

      However, the features you've added are already possible with the official release - number 2 and 3 in lib/config.php:

      * By setting $config['defaultChannelID'] to an existing forum ID the channel "Public" (or what you've defined as $config['defaultChannelName']) won't be included.

      * There is a setting $config['limitChannelList'] with which you can define an array of channelIDs to limit the number of forums used as channels.

      Categories are excluded by design, but you can add them nonetheless by removing two lines from the method CustomAJAXChat->getAllChannels() in lib/class/CustomAJAXChat.php:
      ---
                                  forum_type=1
                              AND
      ---

      Regards,
      Sebastian

       

Log in to post a comment.