I have this change. But, not work. Hooks are all in green display. All active.
sources/ChatIntegrate.php
<?php
/**
* ElkArte Ajax Chat
*
* @author wintstar
* @license BSD http://opensource.org/licenses/BSD-3-Clause
* @license Bluimp's AJAX Chat is released under a Modified MIT License (MIT) https://raw.githubusercontent.com/Frug/AJAX-Chat/master/chat/license.txt
*
* @version 0.0.1beta
*/
if (!defined('ELK'))
die('No access...');
function ias_chat(&$actions)
{
$actions['chat'] = array('Chat.controller.php', 'Chat_Controller', 'action_chat');
}
function ica_chat(&$current_action)
{
if ($current_action === 'chat')
{
if (empty($_REQUEST['action']))
$current_action = 'chat';
}
}
function imp_chat(&$buttons, &$menu_count)
{
global $context, $txt, $boardurl, $scripturl;
loadLanguage('Chat');
function chatOnlineUsers(){
global $scripturl, $txt, $user_info, $modSettings;
$db = database();
$userIDs = array();
$request = $db->query('', '
SELECT userID
FROM {db_prefix}chat_online WHERE NOW() <= DATE_ADD(dateTime, interval 2 MINUTE)' ,
array()
);
while ($row = $db->fetch_assoc($request)) {
array_push($userIDs, $row['userID']);
}
$db->free_result($request);
return array_unique($userIDs);
}
$num = !empty($modSettings['enableChatButtonNo']) ? 0 : count(chatOnlineUsers());
$chatButton = $txt['chat_index'];
$chatButton .= ($num > 0) ? ('('.$num.')') : '';
$buttons = elk_array_insert($buttons, 'unread', array(
'chat' => array(
'title' => $chatButton,
'href' => $scripturl . '?action=chat',
'data-icon' => '',
'show' => $context['allow_admin'],
),
));
}
function ihp_chat()
{
// Load the Chat Help file.
loadLanguage('Chat');
}
function iaa_chat(&$admin_areas)
{
global $txt;
loadlanguage('Chat');
isAllowedTo('admin_forum');
$admin_areas['config']['areas']['addonsettings']['subsections']['chat'] = array($txt['chat']);
}
function imm_chat($sub_actions)
{
$sub_actions['chat'] = array(
'dir' => SOURCEDIR,
'file' => 'ChatIntegration.php',
'function' => 'ModifyChatSettings'
);
}
/**
* ModifyChatSettings()
*
* - Defines our settings array and uses our settings class to manage the data
*/
function ModifyChatSettings()
{
global $txt, $scripturl, $context;
loadlanguage('Chat');
$context[$context['admin_menu_name']]['tab_data']['tabs']['chat']['description'] = $txt['chat_desc'];
// Lets build a settings form
require_once(SUBSDIR . '/SettingsForm.class.php');
// Instantiate the form
$chatSettings = new Settings_Form();
$config_vars = array(
array('title', 'chat_Settings'),
array('check', 'chat_above_enabled'),
array('check', 'chat_anypage_enabled'),
array('check', 'chat_below_enabled'),
array('check', 'chat_page_enabled'),
array('check', 'chat_popup_enabled'),
array('check', 'chat_button_enabled'),
array('check', 'chat_header_enabled'),
array('check', 'chat_user_enabled'),
);
// Load the settings to the form class
$chatSettings->settings($config_vars);
// Saving?
if (isset($_GET['save']))
{
checkSession();
Settings_Form::save_db($config_vars);
redirectexit('action=admin;area=addonsettings;sa=chat');
}
// Continue on to the settings template
$context['post_url'] = $scripturl . '?action=admin;area=addonsettings;save;sa=chat';
$context['settings_title'] = $txt['chat'];
Settings_Form::prepare_db($config_vars);
return;
}
function ilp_chat(&$permissionGroups, &$permissionList, &$leftPermissionGroups, &$hiddenPermissions, &$relabelPermissions)
{
global $context, $txt, $helptxt, $modSettings;
loadLanguage('Chat');
$permissionList['membergroup']['chat_admin'] = array(false, 'chat', 'chat');
$permissionList['membergroup']['chat_moderator'] = array(false, 'chat', 'chat');
$permissionList['membergroup']['chat_view_chatpage'] = array(false, 'chat', 'chat');
$permissionList['membergroup']['chat_view_talkbox'] = array(false, 'chat', 'chat');
$permissionList['membergroup']['chat_view_chatuser'] = array(false, 'chat', 'chat');
$permissionGroups['membergroup'][] = 'chat';
$leftPermissionGroups[] = 'chat';
}
function ips_chat()
{
global $context, $txt, $helptxt, $modSettings;
loadLanguage('Chat');
// Guests shouldn't be able to have any portal specific permissions.
$context['non_guest_permissions'] = array_merge($context['non_guest_permissions'], array(
'chat_admin',
'chat_moderator',
));
}
sources/controllers/Chat.controller.php
<?php
/**
* ElkArte Ajax Chat
*
* @author wintstar
* @license BSD http://opensource.org/licenses/BSD-3-Clause
* @license Bluimp's AJAX Chat is released under a Modified MIT License (MIT) https://raw.githubusercontent.com/Frug/AJAX-Chat/master/chat/license.txt
*
* @version 0.0.1beta
*/
if (!defined('ELK'))
die('No access...');
class Chat_Controller extends Action_Controller
{
public function pre_dispatch()
{
global $modSettings;
// Some things we will need
loadLanguage('Chat');
// Are we allowed to view the map?
isAllowedTo('chat_view_chatpage');
}
public function action_index()
{
return $this->action_chat();
}
public function action_chat()
{
global $txt, $context, $scripturl;
loadLanguage('Chat');
loadCSSFile('chat.css');
loadTemplate('Chat');
$context['sub_template'] = 'chat';
$context['page_title'] = $context['forum_name'] . ' - ' . $txt['chat_index'];
// Build the link tree.
$context['linktree'][] = array(
'url' => $scripturl . '?action=chat',
'name' => $txt['chat'],
);
}
}