Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Creating custom Buoy chat systems

Meitar M edited this page Apr 24, 2016 · 3 revisions

WikiDocumentationDeveloper DocumentationCreating custom Buoy chat systems

Buoy's chat system is "hookable," meaning that programmers familiar with the PHP programming language and the WordPress Plugin API can replace, modify, or extend Buoy's chat system by writing custom code. This page is intended to show how developers or ambitious Buoy site admins can write code to customize their users' Buoy chat room experience.

This guide assumes you are somewhat familiar with the PHP programing language and WordPress's "hook system." If you're new to PHP, try some of the beginner exercises from Learn-PHP.org. If you're new to the WordPress hook system, take some time to familiarize yourself with the WordPress Plugin API.

⚠️ This API is unstable and may change at any time. If these examples don't work for you, it may mean that the Buoy chat system has undergone a breaking (backwards-incompatible) change. Although we try sticking to the SemVer scheme to alert you of such changes, things are changing very quickly and may not always be consistent even in some patch-level releases.

Examples

Prepend a "Hello Buoy room" message to the top of the chat room.

function my_buoy_chat_room_div_wrapper ($alert, $curr_user) {
    print "Hello Buoy room.";
}
// Use priority 1 so your action is called before Buoy's (which is priority 10)
add_action('buoy_chat_room', 'my_buoy_chat_room_div_wrapper', 1, 2);

Completely replace the Buoy chat room with your own custom chat room code.

function my_custom_buoy_chat_room ($alert, $curr_user) {
    // Your custom code here.
}
remove_all_actions('buoy_chat_room'); // removes the Buoy plugin's chat room
add_action('buoy_chat_room', 'my_custom_buoy_chat_room', 10, 2);
Clone this wiki locally