PHP Help Center Chat [Deleted]

Daniel Hood

Well-known member
Daniel Hood submitted a new resource:

PHP Help Center Chat - An ajax powered chat addon for XenForo. Brought to you by PHP Help Center.

PHP Help Center Chat - A XenForo Addon.

Important

For the chat to work you will need to edit permissions for each group. Make sure the guest group isn't permitted to chat as that isn't enabled yet.


Core Features
  1. Ajax long polling, this chat is powered by jQuery's ajax long polling. This reduces the amount of connections in addition to staying...

Read more about this resource...
 
Sorry, I will take a few screenshots. The messages were slow because I have it on up to a 1 second delay. This can be adjusted in the php file (I'll make it an option for the admin panel in an upcoming release). I did notice an issue, a person leaving the chat results in a jquery error. I'm about to fix this now.

Daniel Hood updated PHP Help Center Chat with a new update entry:

First Bug Fixes

Update addresses:
-users not being removed from user list.
-shortened message delay

Read the rest of this update entry...
 
Last edited:
Tried your demo and while I could see what I typed.... I could not see anything submitted by myself or anyone else (see screen shot).

Further, when leaving the chat and going to the forum.... Got some kind of error telling me if couldn't connect (though I did reach the forum)
 

Attachments

  • Capture.webp
    Capture.webp
    7.3 KB · Views: 27
Can I get your browser information? I've experienced the error saying couldn't connect. It's supposed to be for if the ajax cannot get the new messages or anything but sometimes happens on user abort (leaving the page).

[Edit] I've tested on Chrome and IE9. I believe it's been tested on Firefox 22
 
That's intended for now. We were showing previous messages but it was buggy. A short message history when first entering the chat is intended.

I think I figured out why it was displaying blank messages. I'll repackage in a few minutes. I had a typo on the default room id for the datawriter.
 
Last edited:
It would be very nice to have this as a Facebook like footer bar.
Are 1to1 chats planned?
 
Personal Messages are already existing, they're just set up as room tabs right now. I do intend on having them site-wide and at the footer like Facebook for a later version though.

Here's a screenshot of a private message room:

screenshot2.png
 
Non-static method PHCchat_Install::_getDb() should not be called statically

  1. XenForo_Application::handlePhpError() in PHCchat/Install.php at line 29
  2. PHCchat_Install::_getDb() in PHCchat/Install.php at line 29
  3. PHCchat_Install::Install()
  4. call_user_func() in XenForo/Model/AddOn.php at line 214
  5. XenForo_Model_AddOn->installAddOnXml() in XenForo/Model/AddOn.php at line 169
  6. XenForo_Model_AddOn->installAddOnXmlFromFile() in XenForo/ControllerAdmin/AddOn.php at line 178
  7. XenForo_ControllerAdmin_AddOn->actionInstall() in XenForo/FrontController.php at line 313
  8. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
 
That's weird. What version of xF are you installing on?

Try this: overwrite xf_root/library/PHCchat/Install.php with this. I had this as the file but when I went to install of xf 1.2 beta 5 it produced error messages.

Code:
<?php

class PHCchat_Install
{
    private static $_instance;
    protected $_db;

    public static final function getInstance()
    {
        if (!self::$_instance)
        {
            self::$_instance = new self;
        }

        return self::$_instance;
    }

    protected function _getDb()
    {
        if ($this->_db === null)
        {
            $this->_db = XenForo_Application::get('db');
        }

        return $this->_db;
    }
    public static function Install()
    {
        $this->_getDb()->query("CREATE TABLE `phcchat_users_online` (
            `user_id` int(10) NOT NULL,
            `enter_time` int(20) NOT NULL DEFAULT '0',
            `last_action_time` int(20) NOT NULL DEFAULT '0',
            PRIMARY KEY (`user_id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
       
        $this->_getDb()->query("CREATE TABLE `phcchat_messages` (
            `message_id` int(10) NOT NULL AUTO_INCREMENT,
            `user_id` int(10) NOT NULL DEFAULT '0',
            `to` varchar(40) NOT NULL DEFAULT 'room:1',
            `message` varchar(225) NOT NULL,
            `data` text NOT NULL,
            `likes` int(5) NOT NULL DEFAULT '0',
            `like_users` blob NOT NULL,
            PRIMARY KEY (`message_id`),
            KEY `likes` (`likes`)
        ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;");
       
        $this->_getDb()->query("INSERT INTO xf_content_type (content_type, addon_id) VALUES ('PHCchat_Message', 'PHCchat')");
       
        $this->_getDb()->query("DELETE FROM xf_data_registry WHERE data_key = 'contentTypes'");
    }
    public static function UnInstall()
    {
        $this->_getDb()->query("DELETE FROM xf_data_registry WHERE data_key = 'contentTypes'");
        $this->_getDb()->query("DELETE FROM xf_content_type WHERE addon_id = 'PHCchat'");
        $this->_getDb()->query("DROP TABLE phcchat_users_online");
        $this->_getDb()->query("DROP TABLE phcchat_messages'");
    }
}
 
That's weird. What version of xF are you installing on?

Try this: overwrite xf_root/library/PHCchat/Install.php with this. I had this as the file but when I went to install of xf 1.2 beta 5 it produced error messages.

Code:
<?php

class PHCchat_Install
{
    private static $_instance;
    protected $_db;

    public static final function getInstance()
    {
        if (!self::$_instance)
        {
            self::$_instance = new self;
        }

        return self::$_instance;
    }

    protected function _getDb()
    {
        if ($this->_db === null)
        {
            $this->_db = XenForo_Application::get('db');
        }

        return $this->_db;
    }
    public static function Install()
    {
        $this->_getDb()->query("CREATE TABLE `phcchat_users_online` (
            `user_id` int(10) NOT NULL,
            `enter_time` int(20) NOT NULL DEFAULT '0',
            `last_action_time` int(20) NOT NULL DEFAULT '0',
            PRIMARY KEY (`user_id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
     
        $this->_getDb()->query("CREATE TABLE `phcchat_messages` (
            `message_id` int(10) NOT NULL AUTO_INCREMENT,
            `user_id` int(10) NOT NULL DEFAULT '0',
            `to` varchar(40) NOT NULL DEFAULT 'room:1',
            `message` varchar(225) NOT NULL,
            `data` text NOT NULL,
            `likes` int(5) NOT NULL DEFAULT '0',
            `like_users` blob NOT NULL,
            PRIMARY KEY (`message_id`),
            KEY `likes` (`likes`)
        ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;");
     
        $this->_getDb()->query("INSERT INTO xf_content_type (content_type, addon_id) VALUES ('PHCchat_Message', 'PHCchat')");
     
        $this->_getDb()->query("DELETE FROM xf_data_registry WHERE data_key = 'contentTypes'");
    }
    public static function UnInstall()
    {
        $this->_getDb()->query("DELETE FROM xf_data_registry WHERE data_key = 'contentTypes'");
        $this->_getDb()->query("DELETE FROM xf_content_type WHERE addon_id = 'PHCchat'");
        $this->_getDb()->query("DROP TABLE phcchat_users_online");
        $this->_getDb()->query("DROP TABLE phcchat_messages'");
    }
}
Fatal error: Using $this when not in object context in .../library/PHCchat/Install.php on line 29
version 1.1.5
 
Sorry, I read the error message from the first file wrong. Try this:

Code:
<?php

class PHCchat_Install
{
    private static $_instance;
    protected static $_db;

    public static final function getInstance()
    {
        if (!self::$_instance)
        {
            self::$_instance = new self;
        }

        return self::$_instance;
    }

    protected static function _getDb()
    {
        if (self::$_db === null)
        {
            self::$_db = XenForo_Application::get('db');
        }

        return self::$_db;
    }
    public static function Install()
    {
        self::_getDb()->query("CREATE TABLE `phcchat_users_online` (
            `user_id` int(10) NOT NULL,
            `enter_time` int(20) NOT NULL DEFAULT '0',
            `last_action_time` int(20) NOT NULL DEFAULT '0',
            PRIMARY KEY (`user_id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
       
        self::_getDb()->query("CREATE TABLE `phcchat_messages` (
            `message_id` int(10) NOT NULL AUTO_INCREMENT,
            `user_id` int(10) NOT NULL DEFAULT '0',
            `to` varchar(40) NOT NULL DEFAULT 'room:1',
            `message` varchar(225) NOT NULL,
            `data` text NOT NULL,
            `likes` int(5) NOT NULL DEFAULT '0',
            `like_users` blob NOT NULL,
            PRIMARY KEY (`message_id`),
            KEY `likes` (`likes`)
        ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;");
       
        self::_getDb()->query("INSERT INTO xf_content_type (content_type, addon_id, fields) VALUES ('PHCchat_Message', 'PHCchat', '')");
       
        self::_getDb()->query("DELETE FROM xf_data_registry WHERE data_key = 'contentTypes'");
    }
    public static function UnInstall()
    {
        self::_getDb()->query("DELETE FROM xf_data_registry WHERE data_key = 'contentTypes'");
        self::_getDb()->query("DELETE FROM xf_content_type WHERE addon_id = 'PHCchat'");
        self::_getDb()->query("DROP TABLE phcchat_users_online");
        self::_getDb()->query("DROP TABLE phcchat_messages'");
    }
}
 
@Daniel Hood

The problem is after the content f5 deleted chat

how to add a button to send the contents enter chat

How to separate two people chat

Add me to chat "messageUserInfo"
 
Currently leaving the chat or refreshing removes all message history. I will add some message history in an upcoming release.

I'll add that button for sending messages for next release.

Two person chats are initiated by scrolling over a person's message and clicking pm. I also plan to add a button to the sidebar under the user's name. Maybe a command also like /pm username

I'm not sure what you're referring to with your last comment.
 
Don't worry about it (the English). That part of it probably wont be added for a little while. the rest of your requests will be included in upcoming releases.
 
Back
Top Bottom