How to create shoutbox of AJAX chat in MyBB

  • ecanikajo

    ecanikajo - 2009-07-11

    Does someone want to explain where we need to insert the following code:


        AJAX Chat is also usable as shoutbox - this is a short guide on how to set it up:

        1. Shoutbox stylesheet

        Add the following line to the stylesheet (CSS) of all pages displaying the shoutbox:

        @import url("");

        Replace with the URL to the chat.
        Modify css/shoutbox.css to your liking.

        2. Shoutbox function

        Add the following function to your PHP code:

        function getShoutBoxContent() {
        // URL to the chat directory:
        if(!defined('AJAX_CHAT_URL')) {
        define('AJAX_CHAT_URL', './chat/');

        // Path to the chat directory:
        if(!defined('AJAX_CHAT_PATH')) {
        define('AJAX_CHAT_PATH', realpath(dirname($_SERVER['SCRIPT_FILENAME']).'/chat').'/');

        // Validate the path to the chat:
        if(@is_file(AJAX_CHAT_PATH.'lib/classes.php')) {

        // Include Class libraries:

        // Initialize the shoutbox:
        $ajaxChat = new CustomAJAXChatShoutBox();

        // Parse and return the shoutbox template content:
        return $ajaxChat->getShoutBoxContent();

        return null;

        Make sure AJAX_CHAT_URL and AJAX_CHAT_PATH point to the chat directory.

        2. Shoutbox output

        Display the shoutbox content using the shoutbox function:

        <div style="width:200px;"><?php echo getShoutBoxContent(); ?></div>

  • zehel

    zehel - 2009-11-11

    Can someone help us with this please? I searched for every thread on mybb on this forum and on mybbboard and no one has the answer to our problem.

    How do we show shoutbox on index(under board stats). What files should we edit?

    Thank you all for your help.

  • Mansoor Khan

    Mansoor Khan - 2011-12-07

    I have been stuggling with this too.  Only thing is that I am trying to put it on an html web page on my site and not on punBB or SF or other bulletin board or forum page.

    Is it possible to set it up on a normal html webpage?

    I already have my Chat Room working here

    But would like to set up the Shoutbox too.

    Any help appreciated. Thanks.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks