Introduction
Change the look and feel of Joinchat by adding some PHP filters in the theme’s functions.php or by using the plugin Code Snippets
Glass effect chat window
function joinchat_chatbox_blur( $classes ) { return $classes . ' joinchat--blur'; } add_filter( 'joinchat_classes', 'joinchat_chatbox_blur' );
Always display the tooltip
function joinchat_always_tooltip() { ?> <script> jQuery(document).on('joinchat:start', function () { setTimeout( function () { joinchat_obj.$div.addClass('joinchat--tooltip'); }, joinchat_obj.settings.button_delay * 1000 ); }); </script> <?php } add_action( 'wp_footer', 'joinchat_always_tooltip', 20 );
Show only for logged-in users
function joinchat_only_for_logged( $show ) { return $show && is_user_logged_in(); } add_filter( 'joinchat_show', 'joinchat_only_for_logged' );
Show only for guest users
function joinchat_only_for_guests( $show ) { return $show && ! is_user_logged_in(); }https://join.chat/wp/wp-admin/post.php?post=11958&action=edit#block-5d032482-b2e5-4695-9589-bf4e95a4a4c6 add_filter( 'joinchat_show', 'joinchat_only_for_guests' );
Add custom Dynamic Variables
Joinchat includes dynamic variables that change their value on each page to display the appropriate message. ({SITE}
, {TITLE}
, {URL}
, {HREF}
, {PRODUCT}
, {SKU}
, {REGULAR}
, {PRICE}
, {DISCOUNT}
). You can also add your own variables:
function joinchat_custom_variables( $variables ) { if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $variables['USERNAME'] = $current_user->display_name; $variables['USEREMAIL'] = $current_user->user_email; } else { $variables['USERNAME'] = 'Guest'; $variables['USEREMAIL'] = 'example@' . wp_parse_url( site_url(), PHP_URL_HOST ); } return $variables; } add_filter ( 'joinchat_variable_replacements', 'joinchat_custom_variables' );