function wpmudev_chat_settings_show_screen_content() { global $wpmudev_chat, $current_user, $bp; $user_meta = get_user_meta($bp->displayed_user->id, 'wpmudev-chat-user', true); $user_meta = wp_parse_args($user_meta, $wpmudev_chat->_chat_options_defaults['user_meta']); $chat_user_status = wpmudev_chat_get_user_status($bp->displayed_user->id); if (isset($wpmudev_chat->_chat_options['user-statuses'][$chat_user_status])) { $user_meta['chat_user_status'] = $chat_user_status; } else { $user_meta['chat_user_status'] = $wpmudev_chat->_chat_options_defaults['user_meta']['chat_user_status']; } ?> <form id="profile-edit-form" class="standard-form base" method="post" action="#"> <div class="editfield wpmudev_chat_status"> <label for="wpmudev_chat_status"><?php _e('Set Chat status', $wpmudev_chat->translation_domain); ?> </label> <p class="description"><?php _e('This user option controls your public chat status to other users within your network. This lets you control when others can initiate private chat sessions with you. Note this does not prevent private chats during existing chat sessions you are participating in.', $wpmudev_chat->translation_domain); ?> </p> <select name="wpmudev_chat_user_settings[chat_user_status]" id="wpmudev_chat_status"> <?php foreach ($wpmudev_chat->_chat_options['user-statuses'] as $status_key => $status_label) { if ($status_key == 'away') { continue; } if ($status_key == $user_meta['chat_user_status']) { $selected = ' selected="selected" '; } else { $selected = ''; } ?> <option value="<?php echo $status_key; ?> " <?php echo $selected; ?> ><?php echo $status_label; ?> </option><?php } ?> </select> </div> <div class="editfield wpmudev_chat_name_display"> <label for="wpmudev_chat_name_display"><?php _e('In Chat Sessions show name as', $wpmudev_chat->translation_domain); ?> </label> <p class="description"><?php _e('During chat sessions you are participating in this setting controls how you will be labelled to other users. Default is display name.', $wpmudev_chat->translation_domain); ?> </p> <select name="wpmudev_chat_user_settings[chat_name_display]" id="wpmudev_chat_name_display"> <option value="display_name" <?php if ($user_meta['chat_name_display'] == 'display_name') { echo ' selected="selected" '; } ?> ><?php echo __('Display Name', $wpmudev_chat->translation_domain) . ": " . $current_user->display_name; ?> </option> <option value="user_login" <?php if ($user_meta['chat_name_display'] == 'user_login') { echo ' selected="selected" '; } ?> ><?php echo __('User Login', $wpmudev_chat->translation_domain) . ": " . $current_user->user_login; ?> </option> </select> </div> <?php if (is_admin_bar_showing()) { ?> <div class="editfield wpmudev_chat_wp_toolbar"> <label for="wpmudev_chat_wp_toolbar"><?php _e('Show Chat WordPress toolbar menu?', $wpmudev_chat->translation_domain); ?> </label> <select name="wpmudev_chat_user_settings[chat_wp_toolbar]" id="wpmudev_chat_wp_toolbar"> <option value="enabled"<?php if ($user_meta['chat_wp_toolbar'] == 'enabled') { echo ' selected="selected" '; } ?> ><?php _e('Enabled', $wpmudev_chat->translation_domain); ?> </option> <option value="disabled"<?php if ($user_meta['chat_wp_toolbar'] == 'disabled') { echo ' selected="selected" '; } ?> ><?php _e('Disabled', $wpmudev_chat->translation_domain); ?> </option> </select> </div> <?php } ?> <div class="submit"> <input id="wpmudev_chat-submit" type="submit" value="<?php _e('Save Changes', $wpmudev_chat->translation_domain); ?> " name="wpmudev_chat"> </div> </form> <?php return; }
/** * Loads the various config options from get_options calls. Parse the config array with the defaults in case new options were added/removed. * * @global none * @param none * @return none */ function load_configs() { global $blog_id; $this->set_option_defaults(); $this->_chat_options['user-statuses'] = get_option('wpmudev-chat-user-statuses', array()); $this->_chat_options['user-statuses'] = wp_parse_args($this->_chat_options['user-statuses'], $this->_chat_options_defaults['user-statuses']); if (isset($_POST['wpmudev-chat-sessions'])) { if (is_array($_POST['wpmudev-chat-sessions']) && count($_POST['wpmudev-chat-sessions'])) { foreach ($_POST['wpmudev-chat-sessions'] as $chat_session) { $chat_id = $chat_session['id']; $transient_key = "chat-session-" . $chat_session['id'] . '-' . $chat_session['session_type']; //echo "transient_key=[". $transient_key ."]<br />"; $chat_session_transient = get_transient($transient_key); if (!empty($chat_session_transient) && is_array($chat_session_transient)) { $chat_session_merge = wp_parse_args($chat_session, $chat_session_transient); if (!empty($chat_session_merge) && is_array($chat_session_merge)) { $chat_session_merge = $this->chat_session_show_via_logs($chat_session_merge); } $this->chat_sessions[$chat_id] = $chat_session_merge; } $this->chat_sessions_meta[$chat_id] = $this->chat_session_get_meta($chat_session); } } } //log_chat_message(__FUNCTION__ .": chat_sessions_meta<pre>". print_r($this->chat_sessions_meta, true). "</pre>"); //log_chat_message(__FUNCTION__ .": chat_sessions<pre>". print_r($this->chat_sessions, true). "</pre>"); foreach ($this->chat_sessions as $chat_id => $chat_session) { if (isset($chat_session['template']) && $chat_session['template'] == "wpmudev-chat-pop-out") { $this->using_popup_out_template = true; } } if (isset($_COOKIE['wpmudev-chat-auth'])) { $this->chat_auth = json_decode(stripslashes($_COOKIE['wpmudev-chat-auth']), true); // IS the user a WP authenticated user? We odn't trust the details. So reset all fields. if (is_user_logged_in()) { // This is needed to update the user's activity we use to check if a user is online and available for chats $current_user = wp_get_current_user(); wpmudev_chat_update_user_activity($current_user->ID); $this->chat_auth['type'] = 'wordpress'; $this->chat_auth['name'] = $current_user->display_name; $this->chat_auth['email'] = $current_user->user_email; $this->chat_auth['auth_hash'] = md5($current_user->ID); $this->chat_auth['profile_link'] = ''; $this->chat_auth['ip_address'] = isset($_SERVER['HTTP_X_FORWARD_FOR']) ? $_SERVER['HTTP_X_FORWARD_FOR'] : $_SERVER['REMOTE_ADDR']; $this->user_meta = get_user_meta($current_user->ID, 'wpmudev-chat-user', true); // Merge the user's meta info with the defaults. $this->user_meta = wp_parse_args($this->user_meta, $this->_chat_options_defaults['user_meta']); // Get the user's Chat status carried as part of the user_meta information $chat_user_status = wpmudev_chat_get_user_status($current_user->ID); if (isset($this->_chat_options['user-statuses'][$chat_user_status])) { $this->user_meta['chat_user_status'] = $chat_user_status; } else { $this->user_meta['chat_user_status'] = $this->_chat_options_defaults['user_meta']['chat_user_status']; } if ($this->user_meta['chat_name_display'] == "user_login") { $this->chat_auth['name'] = $current_user->user_login; } else { $this->chat_auth['name'] = $current_user->display_name; } // We can only get the avatar when not in SHORTINIT mode since SHORTINIT removes all other plugin filters. if (!defined('WPMUDEV_CHAT_SHORTINIT') || WPMUDEV_CHAT_SHORTINIT != true) { $avatar = get_avatar($current_user->ID, 96, get_option('avatar_default'), $this->chat_auth['name']); if ($avatar) { $avatar_parts = array(); if (stristr($avatar, ' src="') !== false) { preg_match('/src="([^"]*)"/i', $avatar, $avatar_parts); } else { if (stristr($avatar, " src='") !== false) { preg_match("/src='([^']*)'/i", $avatar, $avatar_parts); } } if (isset($avatar_parts[1]) && !empty($avatar_parts[1])) { $this->chat_auth['avatar'] = $avatar_parts[1]; } } } $this->chat_auth['chat_status'] = $this->user_meta['chat_user_status']; } } else { $this->chat_auth = array(); } foreach ($this->chat_sessions as $session_id => $chat_session) { //if ((isset($_POST['function'])) && ($_POST['function'] === 'chat_meta_leave_private_session')) { if ($chat_session['session_type'] == "private") { //log_chat_message(__FUNCTION__ .": ". __LINE__ .": user hash[". $this->chat_auth['auth_hash'] ."] moderator[". $this->chat_sessions[$session_id]['moderator'] ."]"); //log_chat_message(__FUNCTION__ .": ". __LINE__ .": invite-info<pre>". print_r($chat_session['invite-info'], true). "</pre>"); //log_chat_message(__FUNCTION__ .": ". __LINE__ .": invite-info auth-hash[". $chat_session['invite-info']['auth_hash'] ."] message auth_hash[". $chat_session['invite-info']['message']['host']['auth_hash'] ."]"); } if (isset($this->chat_auth['type']) && $this->chat_auth['type'] == 'wordpress') { if (wpmudev_chat_is_moderator($chat_session)) { $this->chat_sessions[$session_id]['moderator'] = "yes"; } else { $this->chat_sessions[$session_id]['moderator'] = "no"; } } else { $this->chat_sessions[$session_id]['moderator'] = "no"; } } // Grab user chat_user cookie data. The chat_user cookie contains user settings like sounds on/off or chat box maximixed/minimized. if (isset($_COOKIE['wpmudev-chat-user'])) { $this->chat_user = json_decode(stripslashes($_COOKIE['wpmudev-chat-user']), true); } if (!isset($this->chat_user['__global__'])) { $this->chat_user['__global__'] = array(); } // The chat_user '__global__' array is the default settings used and compared to the individual settings from the chat_user cookie if (!isset($this->chat_user['__global__']['status_max_min'])) { $this->chat_user['__global__']['status_max_min'] = "max"; } if (!isset($this->chat_user['__global__']['sound_on_off'])) { $this->chat_user['__global__']['sound_on_off'] = "on"; } $this->_chat_options['page'] = get_option('wpmudev-chat-page', array()); // Note: For tinymce options we want to allow to conditions. First if these option is NOT set // then we pull the default. But we need to allow the admin to clear the selection. So if the // item is found but empty we don't merge the default options. if (empty($this->_chat_options['page'])) { // If empty see if we have an older version $_chat_options_default = get_option('chat_default', array()); if (!empty($_chat_options_default)) { $this->_chat_options['page'] = $this->convert_config('page', $_chat_options_default); } $this->_chat_options['page']['tinymce_roles'] = array('administrator'); $this->_chat_options['page']['tinymce_post_types'] = array('page'); } $this->_chat_options['page'] = wp_parse_args($this->_chat_options['page'], $this->_chat_options_defaults['page']); $this->_chat_options['site'] = get_option('wpmudev-chat-site', array()); if (empty($this->_chat_options['site'])) { // If empty see if we have an older version $_chat_options_site = get_option('chat_site', array()); if (!empty($_chat_options_site)) { $this->_chat_options['site'] = $this->convert_config('site', $_chat_options_site); } } $this->_chat_options['site'] = wp_parse_args($this->_chat_options['site'], $this->_chat_options_defaults['site']); $this->_chat_options['widget'] = get_option('wpmudev-chat-widget', array()); $this->_chat_options['widget'] = wp_parse_args($this->_chat_options['widget'], $this->_chat_options_defaults['widget']); $this->_chat_options['bp-group'] = get_option('wpmudev-chat-bp-group', array()); $this->_chat_options['bp-group'] = wp_parse_args($this->_chat_options['bp-group'], $this->_chat_options_defaults['bp-group']); $this->_chat_options['global'] = get_option('wpmudev-chat-global', array()); if (empty($this->_chat_options['global'])) { // If empty see if we have an older version $_chat_options_global = get_option('chat_default', array()); if (!empty($_chat_options_global)) { $this->_chat_options['global'] = $this->convert_config('global', $_chat_options_global); } } $this->_chat_options['global'] = wp_parse_args($this->_chat_options['global'], $this->_chat_options_defaults['global']); $this->_chat_options['banned'] = get_option('wpmudev-chat-banned', array()); $this->_chat_options['banned'] = wp_parse_args($this->_chat_options['banned'], $this->_chat_options_defaults['banned']); $this->_chat_options_defaults['fonts_list'] = array("Arial" => "Arial, Helvetica, sans-serif", "Arial Black" => "'Arial Black', Gadget, sans-serif", "Bookman Old Style" => "'Bookman Old Style', serif", "Comic Sans MS" => "'Comic Sans MS', cursive", "Courier" => "Courier, monospace", "Courier New" => "'Courier New', Courier, monospace", "Garamond" => "Garamond, serif", "Georgia" => "Georgia, serif", "Impact" => "Impact, Charcoal, sans-serif", "Lucida Console" => "'Lucida Console', Monaco, monospace", "Lucida Sans Unicode" => "'Lucida Sans Unicode', 'Lucida Grande', sans-serif", "MS Sans Serif" => "'MS Sans Serif', Geneva, sans-serif", "MS Serif" => "'MS Serif', 'New York', sans-serif", "Palatino Linotype" => "'Palatino Linotype', 'Book Antiqua', Palatino, serif", "Symbol" => "Symbol, sans-serif", "Tahoma" => "Tahoma, Geneva, sans-serif", "Times New Roman" => "'Times New Roman', Times, serif", "Trebuchet MS" => "'Trebuchet MS', Helvetica, sans-serif", "Verdana" => "Verdana, Geneva, sans-serif", "Webdings" => "Webdings, sans-serif", "Wingdings" => "Wingdings, 'Zapf Dingbats', sans-serif"); if (!defined('WPMUDEV_CHAT_SHORTINIT') || WPMUDEV_CHAT_SHORTINIT != true) { $this->_chat_plugin_settings['blocked_urls']['admin'] = wpmudev_chat_check_is_blocked_urls($this->get_option('blocked_admin_urls', 'global'), $this->get_option('blocked_admin_urls_action', 'global'), false); $this->_chat_plugin_settings['blocked_urls']['site'] = wpmudev_chat_check_is_blocked_urls($this->get_option('blocked_urls', 'site'), $this->get_option('blocked_urls_action', 'site'), false); $this->_chat_plugin_settings['blocked_urls']['widget'] = wpmudev_chat_check_is_blocked_urls($this->get_option('blocked_urls', 'widget'), $this->get_option('blocked_urls_action', 'widget'), true); if ($this->get_option('load_jscss_all', 'global') == "enabled") { $this->_chat_plugin_settings['blocked_urls']['front'] = wpmudev_chat_check_is_blocked_urls($this->get_option('blocked_front_urls', 'global'), $this->get_option('blocked_front_urls_action', 'global'), false); } else { $this->_chat_plugin_settings['blocked_urls']['front'] = true; } } // Related to the Network settings. if ($this->_chat_plugin_settings['network_active'] == true) { $this->_chat_options['network-site'] = get_site_option('wpmudev-chat-network-site', array()); $this->_chat_options['network-site'] = wp_parse_args($this->_chat_options['network-site'], $this->_chat_options_defaults['network-site']); } }
/** * Called when the User profile is to be edited. This function adds some fields to the profile form specific to our chat plugin. * * @global none * * @param $user - This is the object of the user being edited. * * @return none */ function chat_edit_user_profile($user = '') { $this->load_configs(); if (!$user) { global $current_user; $user = $current_user; } $user_meta = get_user_meta($user->ID, 'wpmudev-chat-user', true); if (!$user_meta) { $user_meta = array(); } $user_meta['chat_user_status'] = wpmudev_chat_get_user_status($user->ID); $user_meta = wp_parse_args($user_meta, $this->_chat_options_defaults['user_meta']); ?> <h3><?php _e('Chat Settings', $this->translation_domain); ?> </h3> <table class="form-table"> <tr> <th> <label for="wpmudev_chat_status"><?php _e('Set Chat status', $this->translation_domain); ?> </label> </th> <td> <select name="wpmudev_chat_user_settings[chat_user_status]" id="wpmudev_chat_status"> <?php foreach ($this->_chat_options['user-statuses'] as $status_key => $status_label) { if ($status_key == 'away') { continue; } if ($status_key == $user_meta['chat_user_status']) { $selected = ' selected="selected" '; } else { $selected = ''; } ?> <option value="<?php echo $status_key; ?> " <?php echo $selected; ?> ><?php echo $status_label; ?> </option><?php } ?> </select> </td> </tr> <tr> <th> <label for="wpmudev_chat_name_display"><?php _e('In Chat Sessions show name as', $this->translation_domain); ?> </label> </th> <td> <select name="wpmudev_chat_user_settings[chat_name_display]" id="wpmudev_chat_name_display"> <option value="display_name" <?php if ($user_meta['chat_name_display'] == 'display_name') { echo ' selected="selected" '; } ?> ><?php echo __('Display Name', $this->translation_domain) . ": " . $user->display_name; ?> </option> <option value="user_login" <?php if ($user_meta['chat_name_display'] == 'user_login') { echo ' selected="selected" '; } ?> ><?php echo __('User Login', $this->translation_domain) . ": " . $user->user_login; ?> </option> </select> </td> </tr> <?php if (current_user_can('list_users')) { ?> <tr> <th> <label for="wpmudev_chat_users_listing"><?php _e('Show Chat Status column on<br />Users > All Users listing?', $this->translation_domain); ?> </label> </th> <td> <select name="wpmudev_chat_user_settings[chat_users_listing]" id="wpmudev_chat_users_listing"> <option value="enabled"<?php if ($user_meta['chat_users_listing'] == 'enabled') { echo ' selected="selected" '; } ?> ><?php _e('Enabled', $this->translation_domain); ?> </option> <option value="disabled"<?php if ($user_meta['chat_users_listing'] == 'disabled') { echo ' selected="selected" '; } ?> ><?php _e('Disabled', $this->translation_domain); ?> </option> </select> </td> </tr> <?php } ?> <tr> <th> <label for="wpmudev_chat_wp_admin"><?php _e('Show Chats within WPAdmin', $this->translation_domain); ?> </label> </th> <td> <select name="wpmudev_chat_user_settings[chat_wp_admin]" id="wpmudev_chat_wp_admin"> <option value="enabled"<?php if ($user_meta['chat_wp_admin'] == 'enabled') { echo ' selected="selected" '; } ?> ><?php _e('Enabled', $this->translation_domain); ?> </option> <option value="disabled"<?php if ($user_meta['chat_wp_admin'] == 'disabled') { echo ' selected="selected" '; } ?> ><?php _e('Disabled', $this->translation_domain); ?> </option> </select> <p class="description"><?php _e('This will disable all Chat functions including WordPress toolbar menu, Dashboard Widgets, etc.', $this->translation_domain); ?> </p> </td> </tr> <tr class="wpmudev_chat_wp_admin_display" <?php if ($user_meta['chat_wp_admin'] != 'enabled') { echo ' style="display:none;" '; } ?> > <th> <label for="wpmudev_chat_wp_toolbar"><?php _e('Show Chat WordPress toolbar menu?', $this->translation_domain); ?> </label> </th> <td> <select name="wpmudev_chat_user_settings[chat_wp_toolbar]" id="wpmudev_chat_wp_toolbar"> <option value="enabled"<?php if ($user_meta['chat_wp_toolbar'] == 'enabled') { echo ' selected="selected" '; } ?> ><?php _e('Enabled', $this->translation_domain); ?> </option> <option value="disabled"<?php if ($user_meta['chat_wp_toolbar'] == 'disabled') { echo ' selected="selected" '; } ?> ><?php _e('Disabled', $this->translation_domain); ?> </option> </select> <div id="wpmudev_chat_wp_toolbar_options" <?php if ($user_meta['chat_wp_toolbar'] == 'disabled') { echo ' style="display:none;" '; } ?> > <p> <select name="wpmudev_chat_user_settings[chat_wp_toolbar_show_status]" id="wpmudev_chat_wp_toolbar_show_status"> <option value="enabled"<?php if ($user_meta['chat_wp_toolbar_show_status'] == 'enabled') { echo ' selected="selected" '; } ?> ><?php _e('Enabled', $this->translation_domain); ?> </option> <option value="disabled"<?php if ($user_meta['chat_wp_toolbar_show_status'] == 'disabled') { echo ' selected="selected" '; } ?> ><?php _e('Disabled', $this->translation_domain); ?> </option> </select> <label for="wpmudev_chat_wp_toolbar_show_status"><?php _e('Show Your Chat Status on WordPress toolbar menu?', $this->translation_domain); ?> </label> </p> <p> <select name="wpmudev_chat_user_settings[chat_wp_toolbar_show_friends]" id="wpmudev_chat_wp_toolbar_show_friends"> <option value="enabled"<?php if ($user_meta['chat_wp_toolbar_show_friends'] == 'enabled') { echo ' selected="selected" '; } ?> ><?php _e('Enabled', $this->translation_domain); ?> </option> <option value="disabled"<?php if ($user_meta['chat_wp_toolbar_show_friends'] == 'disabled') { echo ' selected="selected" '; } ?> ><?php _e('Disabled', $this->translation_domain); ?> </option> </select> <label for="wpmudev_chat_wp_toolbar_show_friends"><?php _e('Show Your Chat Friends on WordPress toolbar menu?', $this->translation_domain); ?> </label> </p> </div> </td> </tr> <?php if ($this->_chat_options['dashboard']['dashboard_widget'] == 'enabled') { if (isset($user->allcaps['level_10']) && $user->allcaps['level_10'] == 1 || array_intersect($this->_chat_options['dashboard']['login_options'], $user->roles)) { ?> <tr class="wpmudev_chat_wp_admin_display" <?php if ($user_meta['chat_wp_admin'] != 'enabled') { echo ' style="display:none;" '; } ?> > <th><label for="wpmudev_chat_dashboard_widget"><?php _e('Show Chat Widget on Dashboard', $this->translation_domain); ?> </label></th> <td> <?php if (is_network_admin()) { $item_key = 'chat_network_dashboard_widget'; } else { $item_key = 'chat_dashboard_widget'; } ?> <select name="wpmudev_chat_user_settings[<?php echo $item_key; ?> ]" id="wpmudev_chat_dashboard_widget"> <option value="enabled"<?php if ($user_meta[$item_key] == 'enabled') { echo ' selected="selected" '; } ?> ><?php _e('Enabled', $this->translation_domain); ?> </option> <option value="disabled"<?php if ($user_meta[$item_key] == 'disabled') { echo ' selected="selected" '; } ?> ><?php _e('Disabled', $this->translation_domain); ?> </option> </select> <div id="wpmudev_chat_dashboard_widget_options" <?php if ($user_meta[$item_key] == 'disabled') { echo ' style="display:none;" '; } ?> <?php if (is_network_admin()) { $item_option_key = 'chat_network_dashboard_widget_height'; } else { $item_option_key = 'chat_dashboard_widget_height'; } ?> <p> <label for="wpmudev_chat_dashboard_widget_height"><?php _e('Height of Chat Widget', $this->translation_domain); ?> </label><br/><input name="wpmudev_chat_user_settings[<?php echo $item_option_key; ?> ]" id="wpmudev_chat_dashboard_widget_height" value="<?php echo $user_meta[$item_option_key]; ?> "/> <?php _e('Default is', $this->translation_domain); ?> <?php echo $this->_chat_options['dashboard']['dashboard_widget_height']; ?> </p> </div> </td> </tr> <?php } } ?> <?php if ($this->_chat_options['dashboard']['dashboard_status_widget'] == 'enabled') { //if (((isset($user->allcaps['level_10'])) && ($user->allcaps['level_10'] == 1)) // || (array_intersect($this->_chat_options['dashboard']['login_options'], $user->roles))) { ?> <tr class="wpmudev_chat_wp_admin_display" <?php if ($user_meta['chat_wp_admin'] != 'enabled') { echo ' style="display:none;" '; } ?> > <th><label for="wpmudev_chat_dashboard_status_widget"><?php _e('Show Chat Status Widget on Dashboard', $this->translation_domain); ?> </label></th> <td> <?php if (is_network_admin()) { $item_key = 'chat_network_dashboard_status_widget'; } else { $item_key = 'chat_dashboard_status_widget'; } ?> <select name="wpmudev_chat_user_settings[<?php echo $item_key; ?> ]" id="wpmudev_chat_dashboard_status_widget"> <option value="enabled"<?php if ($user_meta[$item_key] == 'enabled') { echo ' selected="selected" '; } ?> ><?php _e('Enabled', $this->translation_domain); ?> </option> <option value="disabled"<?php if ($user_meta[$item_key] == 'disabled') { echo ' selected="selected" '; } ?> ><?php _e('Disabled', $this->translation_domain); ?> </option> </select> </td> </tr> <?php //} } ?> <?php if ($this->_chat_options['dashboard']['dashboard_friends_widget'] == 'enabled') { global $bp; if (empty($bp) && !is_plugin_active('friends/friends.php') && (is_multisite() && !is_plugin_active_for_network('friends/friends.php'))) { } else { //if (((isset($user->allcaps['level_10'])) && ($user->allcaps['level_10'] == 1)) // || (array_intersect($this->_chat_options['dashboard']['login_options'], $user->roles))) { ?> <tr class="wpmudev_chat_wp_admin_display" <?php if ($user_meta['chat_wp_admin'] != 'enabled') { echo ' style="display:none;" '; } ?> > <th><label for="wpmudev_chat_dashboard_friends_widget"><?php _e('Show Chat Friends Widget on Dashboard', $this->translation_domain); ?> </label> </th> <td> <?php if (is_network_admin()) { $item_key = 'chat_network_dashboard_friends_widget'; } else { $item_key = 'chat_dashboard_friends_widget'; } ?> <select name="wpmudev_chat_user_settings[<?php echo $item_key; ?> ]" id="wpmudev_chat_dashboard_friends_widget"> <option value="enabled"<?php if ($user_meta[$item_key] == 'enabled') { echo ' selected="selected" '; } ?> ><?php _e('Enabled', $this->translation_domain); ?> </option> <option value="disabled"<?php if ($user_meta[$item_key] == 'disabled') { echo ' selected="selected" '; } ?> ><?php _e('Disabled', $this->translation_domain); ?> </option> </select><br/> <div id="wpmudev_chat_dashboard_friends_widget_options" <?php if ($user_meta[$item_key] == 'disabled') { echo ' style="display:none;" '; } ?> <?php if (is_network_admin()) { $item_option_key = 'chat_network_dashboard_friends_widget_height'; } else { $item_option_key = 'chat_dashboard_friends_widget_height'; } ?> <p> <label for="wpmudev_chat_dashboard_friends_widget_height"><?php _e('Min Height of Chat Friends Widget', $this->translation_domain); ?> </label><br/><input name="wpmudev_chat_user_settings[<?php echo $item_option_key; ?> ]" id="wpmudev_chat_dashboard_friends_widget_height" value="<?php echo $user_meta[$item_option_key]; ?> "/> <?php _e('Default is', $this->translation_domain); ?> <?php echo $this->_chat_options['dashboard']['dashboard_friends_widget_height']; ?> </p> </div> </td> </tr> <?php } } ?> </table> <?php }
function wpmudev_chat_status_dashboard_widget_proc() { global $wpmudev_chat, $current_user; $chat_output = ''; $chat_user_status = wpmudev_chat_get_user_status($current_user->ID); foreach ($wpmudev_chat->_chat_options['user-statuses'] as $status_key => $status_label) { if ($status_key == $chat_user_status) { $selected = ' selected="selected" '; } else { $selected = ''; } $class = ''; if ($status_key == 'available') { $class .= ' available'; } $chat_output .= '<option class="' . $class . '" value="' . $status_key . '" ' . $selected . '>' . $status_label . '</option>'; } if (!empty($chat_output)) { echo '<select id="wpmudev-chat-status-widget-dashboard" class="wpmudev-chat-status-widget">' . $chat_output . '</select>'; } }