How to use simple chat
Using Jamroom
PS: If you have a Community quota (like I do, enable the chat on that quota too!)
updated by @elise: 12/01/16 08:53:43AM
<?php
/**
* @copyright 2016 Talldude Networks, LLC.
*/
// make sure we are not being called directly
defined('APP_DIR') or exit();
//------------------------------
// auto_notify_save
//------------------------------
function view_jrAutoNotify($_post, &$_user, &$_conf)
{
jrUser_master_only();
jrCore_page_include_admin_menu();
jrCore_page_admin_tabs('jrAutoNotify');
jrCore_page_banner('Choose Auto Notificaton');
// Form init
$_tmp = array(
'submit_value' => 'Set Notifications',
'cancel' => "{$_conf['jrCore_base_url']}/{$_post['module_url']}/admin/tools",
'submit_prompt' => 'Are you sure you want to set this Auto Notificaton?',
'submit_modal' => 'update',
'modal_width' => 800,
'modal_height' => 400,
'modal_note' => 'Please Wait'
);
jrCore_form_create($_tmp);
$_tmp = array(
'name' => 'dummy',
'value' => 'off',
'type' => 'hidden'
);
jrCore_form_field_create($_tmp);
jrCore_page_display();
}
<?php
// make sure we are not being called directly
defined('APP_DIR') or exit();
/**
* config
*/
function jrAutoNotify_config(){
// Additional Fields
$_tmp = array(
'name' => 'category_id',
'type' => 'text',
'default' => '1',
'validate' => '',
'label' => 'forum category id for notification',
'help' => 'category id',
'section' => 'notify forum category',
'order' => 1
);
jrCore_register_setting('jrAutoNotify', $_tmp);
return true;
}
<?php
/**
* @copyright 2016 Talldude Networks, LLC.
*/
// make sure we are not being called directly
defined('APP_DIR') or exit();
/**
* meta
*/
function jrAutoNotify_meta(){
$_tmp = array(
'name' => 'Auto Notify',
'url' => 'auto-notify',
'version' => '0.0.1',
'developer' => 'The Jamroom Network, ©' . strftime('%Y'),
'description' => 'A listener module. Upon user registration, auto notify on forum posts in specified categories',
'category' => 'custom',
'requires' => '',
'license' => 'jcl'
);
return $_tmp;
}
/**
* init
*/
function jrAutoNotify_init(){
// Event Listener
jrCore_register_event_listener('jrUser', 'signup_activated', 'jrAutoNotify_signup_activated_listener');
return true;
}
//----------------------
// EVENT LISTENERS
//----------------------
/**
* Listen for the 'signup_activated' event and add user as watcher of forum category
* @param $_data array incoming data array
* @param $_user array current user info
* @param $_conf array Global config
* @param $_args array additional info about the module
* @param $event string Event Trigger name
* @return array
*/
function jrAutoNotify_signup_activated_listener($_data, $_user, $_conf, $_args, $event)
{
if (isset($_conf['jrAutoNotify_category_id']) && strlen($_conf['jrAutoNotify_category_id']) > 0) {
$cid = (int) $_conf['jrAutoNotify_category_id'];
$uid = (int) $_user['_user_id'];
$tbl = jrCore_db_table_name('jrForum', 'follow_category');
$req = "INSERT IGNORE INTO {$tbl} (follow_cat_id,follow_user_id) VALUES ('{$cid}','{$uid}')";
//i dont know what this does...
$tag = $_ln['jrForum'][119];
jrCore_db_query($req);
// reset forum cache for this user
jrCore_delete_all_cache_entries('jrForum', $_user['_user_id']);
}
return $_data;
}