diff --git a/README.md b/README.md index 81a66ea..a96ed26 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,14 @@ # Chatwoot Plugin # -**Contributors:** antpb -**Tags:** comments, spam -**Requires at least:** 4.5 -**Tested up to:** 5.5.3 -**Requires PHP:** 5.6 -**Stable tag:** 0.1.0 -**License:** GPLv2 or later -**License URI:** https://www.gnu.org/licenses/gpl-2.0.html - -This plugin allows you to embed a Chatwoot widget on every front end page of your WordPress. - -## Description ## - -A few notes about the sections above: +**Contributors:** antpb +**Tags:** comments, live-chat +**Requires at least:** 4.5 +**Tested up to:** 5.8 +**Requires PHP:** 5.6 +**Stable tag:** 0.2.0 +**License:** GPLv2 or later +**License URI:** https://www.gnu.org/licenses/gpl-2.0.html +This plugin allows you to add a Chatwoot live-chat widget on every page of your WordPress website. This plugin also allows you customize the widget by providing options to select locale, position, design type etc. ## Installation ## @@ -22,17 +17,16 @@ This section describes how to install the plugin and get it working. e.g. 1. Download Release Zip and use the WordPress plugin upload options. -1. Activate the plugin through the 'Plugins' menu in WordPress -1. Go to Settings > Chatwoot Settings - -## Frequently Asked Questions ## - -### A question that someone might have ### - -An answer to that question. +2. Activate the plugin through the 'Plugins' menu in WordPress +3. Go to Settings > Chatwoot Settings ## Changelog ## +### 0.2.0 ### +- Add options for customizing the plugin +- Allow admin to select the locale from the settings panel. +- Update the admin settings styles. + ### 0.1.0 ### -Initializes Plugin -Simple Embed based on Options saved +- Initialize Plugin +- Simple Embed based on Options saved diff --git a/admin.css b/admin.css index 0359152..5122b49 100644 --- a/admin.css +++ b/admin.css @@ -1,3 +1,32 @@ -#chatwootSiteURL, #chatwootSiteToken { - min-width: 400px; +.form--input label { + font-weight: 600; + margin-bottom: 4px; + display: block; +} + +.form--input input { + margin-bottom: 16px; + min-width: 400px; +} + +.form--input select { + margin-bottom: 16px; + min-width: 400px; +} + +.chatwoot--form { + background: #fff; + border-radius: 8px; + padding: 32px; + margin-right: 16px; +} + +.chatwoot--form .submit { + margin: 0; + padding: 0; +} + +.chatwoot--form hr { + margin-bottom: 24px; + margin-top: 16px; } diff --git a/chatwoot-plugin.php b/chatwoot-plugin.php index 122d51b..472d99b 100644 --- a/chatwoot-plugin.php +++ b/chatwoot-plugin.php @@ -2,12 +2,11 @@ /** * Plugin Name: Chatwoot Plugin * Plugin URI: https://www.chatwoot.com/ - * Description: Chatwoot Plugin for WordPress + * Description: Chatwoot Plugin for WordPress. This plugin helps you to quickly integrate Chatwoot live-chat widget on Wordpress websites. * Author: antpb - * Author URI: antpb.com + * Author URI: chatwoot.com * Text Domain: chatwoot-plugin - * Domain Path: /languages - * Version: 0.1.0 + * Version: 0.2.0 * * @package chatwoot-plugin */ @@ -49,10 +48,18 @@ function chatwoot_load() { // Get our site options for site url and token. $chatwoot_url = get_option('chatwootSiteURL'); $chatwoot_token = get_option('chatwootSiteToken'); + $chatwoot_widget_locale = get_option('chatwootWidgetLocale'); + $chatwoot_widget_type = get_option('chatwootWidgetType'); + $chatwoot_widget_position = get_option('chatwootWidgetPosition'); + $chatwoot_launcher_text = get_option('chatwootLauncherText'); // Localize our variables for the Javascript embed code. - wp_localize_script( 'chatwoot-client', 'chatwoot_token', $chatwoot_token ); - wp_localize_script( 'chatwoot-client', 'chatwoot_url', $chatwoot_url ); + wp_localize_script('chatwoot-client', 'chatwoot_token', $chatwoot_token); + wp_localize_script('chatwoot-client', 'chatwoot_url', $chatwoot_url); + wp_localize_script('chatwoot-client', 'chatwoot_widget_locale', $chatwoot_widget_locale); + wp_localize_script('chatwoot-client', 'chatwoot_widget_type', $chatwoot_widget_type); + wp_localize_script('chatwoot-client', 'chatwoot_launcher_text', $chatwoot_launcher_text); + wp_localize_script('chatwoot-client', 'chatwoot_widget_position', $chatwoot_widget_position); } add_action('admin_menu', 'chatwoot_setup_menu'); @@ -76,10 +83,19 @@ function chatwoot_setup_menu(){ * @return {void}. */ function chatwoot_register_settings() { - add_option( 'chatwootSiteToken', ''); - add_option( 'chatwootSiteURL', ''); - register_setting( 'chatwoot-plugin-options', 'chatwootSiteToken', 'myplugin_callback' ); - register_setting( 'chatwoot-plugin-options', 'chatwootSiteURL', 'myplugin_callback' ); + add_option('chatwootSiteToken', ''); + add_option('chatwootSiteURL', ''); + add_option('chatwootWidgetLocale', 'en'); + add_option('chatwootWidgetType', 'standard'); + add_option('chatwootWidgetPosition', 'right'); + add_option('chatwootLauncherText', ''); + + register_setting('chatwoot-plugin-options', 'chatwootSiteToken' ); + register_setting('chatwoot-plugin-options', 'chatwootSiteURL'); + register_setting('chatwoot-plugin-options', 'chatwootWidgetLocale' ); + register_setting('chatwoot-plugin-options', 'chatwootWidgetType' ); + register_setting('chatwoot-plugin-options', 'chatwootWidgetPosition' ); + register_setting('chatwoot-plugin-options', 'chatwootLauncherText' ); } /** @@ -92,24 +108,91 @@ function chatwoot_register_settings() { function chatwoot_options_page() { ?>