WP-Chatbot for Facebook Messenger Customer Chat - Version 2.1

Version Description

change messenger theme color change greetings text for logged in user change greetings text for logged out user

Download this release

Release Info

Developer bhvreddy
Plugin Icon 128x128 WP-Chatbot for Facebook Messenger Customer Chat
Version 2.1
Comparing to
See all releases

Code changes from version 2.0 to 2.1

admin/admin.php CHANGED
@@ -17,6 +17,9 @@ require_once('class-htcc-lang.php');
17
  require_once('class-htcc-admin.php');
18
 
19
 
 
 
 
20
  $admin = new HTCC_Admin();
21
  add_action('admin_menu', array( $admin, 'htcc_options_page') );
22
  add_action( 'admin_init', array( $admin, 'htcc_custom_settings' ) );
17
  require_once('class-htcc-admin.php');
18
 
19
 
20
+ require_once('class-htcc-enqueue.php');
21
+
22
+
23
  $admin = new HTCC_Admin();
24
  add_action('admin_menu', array( $admin, 'htcc_options_page') );
25
  add_action( 'admin_init', array( $admin, 'htcc_custom_settings' ) );
admin/class-htcc-admin.php CHANGED
@@ -11,7 +11,7 @@
11
 
12
  if ( ! defined( 'ABSPATH' ) ) exit;
13
 
14
- if ( ! class_exists( 'htcc_Admin' ) ) :
15
 
16
  class HTCC_Admin {
17
 
@@ -74,7 +74,12 @@ class HTCC_Admin {
74
  add_settings_field( 'enable', __( 'Enable' , 'wp-chatbot' ), array( $this, 'htcc_enable_cb' ), 'htcc_options_settings', 'htcc_settings' );
75
  add_settings_field( 'htcc_fb_app_id', __( 'Facebook App ID' , 'wp-chatbot' ), array( $this, 'htcc_fb_app_id_cb' ), 'htcc_options_settings', 'htcc_settings' );
76
  add_settings_field( 'htcc_fb_page_id', __( 'Facebook Page ID' , 'wp-chatbot' ), array( $this, 'htcc_fb_page_id_cb' ), 'htcc_options_settings', 'htcc_settings' );
77
-
 
 
 
 
 
78
 
79
  add_settings_field( 'htcc_show_hide', __( 'Hide Based on post type' , 'wp-chatbot' ), array( $this, 'htcc_show_hide_post_types_cb' ), 'htcc_options_settings', 'htcc_settings' );
80
  add_settings_field( 'htcc_list_id_tohide', __( 'Post, Page Id\'s to Hide' , 'wp-chatbot' ), array( $this, 'htcc_list_id_tohide_cb' ), 'htcc_options_settings', 'htcc_settings' );
@@ -129,6 +134,79 @@ class HTCC_Admin {
129
  <p class="description"><?php _e( 'Facebook Page ID - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/find-facebook-page-id/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
130
  <?php
131
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
 
134
  // sdk lang. / messenger lang
@@ -152,6 +230,7 @@ class HTCC_Admin {
152
  </select>
153
  </div>
154
  <p class="description"><?php _e( 'Language what display in chat window, not user input - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/messenger-language/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
 
155
  <p class="description"><?php _e( 'If desired Language is not added - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://www.messenger.com/t/1541811499235090/"><?php _e( 'please message us' , 'wp-chatbot' ) ?></a> </p>
156
  <?php
157
  }
@@ -159,11 +238,13 @@ class HTCC_Admin {
159
  // minimized
160
  public function htcc_fb_is_minimized_cb() {
161
  $minimized = get_option('htcc_options');
 
162
  ?>
163
  <div>
164
  <select name="htcc_options[minimized]" class="select-1">
165
- <option value="false"><?php _e( 'False' , 'wp-chatbot' ) ?></option>
166
- <option value="true" <?php echo esc_attr( $minimized['minimized'] ) == 'true' ? 'SELECTED' : ''; ?> ><?php _e( 'True' , 'wp-chatbot' ) ?></option>
 
167
  </select>
168
  </div>
169
  <p class="description"><?php _e( 'If true - chat window is minimized' , 'wp-chatbot' ) ?> </p>
@@ -431,6 +512,20 @@ class HTCC_Admin {
431
  if( isset( $input['fb_page_id'] ) )
432
  $new_input['fb_page_id'] = sanitize_text_field( $input['fb_page_id'] );
433
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
  if( isset( $input['fb_sdk_lang'] ) )
435
  $new_input['fb_sdk_lang'] = sanitize_text_field( $input['fb_sdk_lang'] );
436
 
11
 
12
  if ( ! defined( 'ABSPATH' ) ) exit;
13
 
14
+ if ( ! class_exists( 'HTCC_Admin' ) ) :
15
 
16
  class HTCC_Admin {
17
 
74
  add_settings_field( 'enable', __( 'Enable' , 'wp-chatbot' ), array( $this, 'htcc_enable_cb' ), 'htcc_options_settings', 'htcc_settings' );
75
  add_settings_field( 'htcc_fb_app_id', __( 'Facebook App ID' , 'wp-chatbot' ), array( $this, 'htcc_fb_app_id_cb' ), 'htcc_options_settings', 'htcc_settings' );
76
  add_settings_field( 'htcc_fb_page_id', __( 'Facebook Page ID' , 'wp-chatbot' ), array( $this, 'htcc_fb_page_id_cb' ), 'htcc_options_settings', 'htcc_settings' );
77
+
78
+
79
+ add_settings_field( 'htcc_fb_color', __( 'Color' , 'wp-chatbot' ), array( $this, 'htcc_fb_color_cb' ), 'htcc_options_settings', 'htcc_settings' );
80
+ add_settings_field( 'htcc_fb_greeting_login', __( 'Logged in Greeting' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_login_cb' ), 'htcc_options_settings', 'htcc_settings' );
81
+ add_settings_field( 'htcc_fb_greeting_logout', __( 'Logged out Greeting' , 'wp-chatbot' ), array( $this, 'htcc_fb_greeting_logout_cb' ), 'htcc_options_settings', 'htcc_settings' );
82
+
83
 
84
  add_settings_field( 'htcc_show_hide', __( 'Hide Based on post type' , 'wp-chatbot' ), array( $this, 'htcc_show_hide_post_types_cb' ), 'htcc_options_settings', 'htcc_settings' );
85
  add_settings_field( 'htcc_list_id_tohide', __( 'Post, Page Id\'s to Hide' , 'wp-chatbot' ), array( $this, 'htcc_list_id_tohide_cb' ), 'htcc_options_settings', 'htcc_settings' );
134
  <p class="description"><?php _e( 'Facebook Page ID - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/find-facebook-page-id/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
135
  <?php
136
  }
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+ // color
149
+ public function htcc_fb_color_cb() {
150
+
151
+ $htcc_fb_color = get_option('htcc_options');
152
+ ?>
153
+ <input name="htcc_options[fb_color]" value="<?php echo esc_attr( $htcc_fb_color['fb_color'] ) ?>" type="text" class="htcc-color-wp" style="height: 1.375rem;" >
154
+
155
+
156
+
157
+ <p class="description"><?php _e( 'messenger theme color , leave empty for default color - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/messenger-theme-color/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
158
+ <?php
159
+ }
160
+
161
+
162
+
163
+ // Greeting for logged in user
164
+ public function htcc_fb_greeting_login_cb() {
165
+
166
+ $htcc_fb_greeting_login = get_option('htcc_options');
167
+ ?>
168
+ <input type="text" name="htcc_options[fb_greeting_login]" id="" value="<?php echo esc_attr( $htcc_fb_greeting_login['fb_greeting_login'] ) ?>">
169
+
170
+
171
+ <p class="description"><?php _e( 'Greetings text for fb logged in user * , leave empty for default message - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/change-facebook-messenger-greetings-text/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
172
+ <?php
173
+ }
174
+
175
+ // Greeting for logged out user
176
+ public function htcc_fb_greeting_logout_cb() {
177
+
178
+ $htcc_fb_greeting_logout = get_option('htcc_options');
179
+ ?>
180
+ <input type="text" name="htcc_options[fb_greeting_logout]" id="" value="<?php echo esc_attr( $htcc_fb_greeting_logout['fb_greeting_logout'] ) ?>">
181
+
182
+
183
+ <p class="description"><?php _e( 'Greetings text for fb logged out user * , leave empty for default message - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/change-facebook-messenger-greetings-text/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
184
+ <?php
185
+ }
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
 
211
 
212
  // sdk lang. / messenger lang
230
  </select>
231
  </div>
232
  <p class="description"><?php _e( 'Language what display in chat window, not user input - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/messenger-language/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
233
+ <p class="description"><?php _e( 'Facebook SDK is not supporting all languages.., please dont consider it, as an error ' , 'wp-chatbot' ) ?> </p>
234
  <p class="description"><?php _e( 'If desired Language is not added - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://www.messenger.com/t/1541811499235090/"><?php _e( 'please message us' , 'wp-chatbot' ) ?></a> </p>
235
  <?php
236
  }
238
  // minimized
239
  public function htcc_fb_is_minimized_cb() {
240
  $minimized = get_option('htcc_options');
241
+ $min_value = esc_attr( $minimized['minimized'] );
242
  ?>
243
  <div>
244
  <select name="htcc_options[minimized]" class="select-1">
245
+ <option value="" <?php echo $min_value == "" ? 'SELECTED' : ''; ?> >Default</option>
246
+ <option value="false" <?php echo $min_value == "false" ? 'SELECTED' : ''; ?> >False</option>
247
+ <option value="true" <?php echo $min_value == "true" ? 'SELECTED' : ''; ?> >True</option>
248
  </select>
249
  </div>
250
  <p class="description"><?php _e( 'If true - chat window is minimized' , 'wp-chatbot' ) ?> </p>
512
  if( isset( $input['fb_page_id'] ) )
513
  $new_input['fb_page_id'] = sanitize_text_field( $input['fb_page_id'] );
514
 
515
+
516
+ if( isset( $input['fb_color'] ) )
517
+ $new_input['fb_color'] = sanitize_text_field( $input['fb_color'] );
518
+
519
+ if( isset( $input['fb_greeting_login'] ) )
520
+ $new_input['fb_greeting_login'] = sanitize_text_field( $input['fb_greeting_login'] );
521
+
522
+ if( isset( $input['fb_greeting_logout'] ) )
523
+ $new_input['fb_greeting_logout'] = sanitize_text_field( $input['fb_greeting_logout'] );
524
+
525
+
526
+
527
+
528
+
529
  if( isset( $input['fb_sdk_lang'] ) )
530
  $new_input['fb_sdk_lang'] = sanitize_text_field( $input['fb_sdk_lang'] );
531
 
admin/class-htcc-enqueue.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * enqueue sytle, scripts
4
+ *
5
+ */
6
+
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) exit;
9
+
10
+ if ( ! class_exists( 'HTCC_Enqueue' ) ) :
11
+
12
+ class HTCC_Enqueue {
13
+
14
+
15
+ function enqueue( $hook ) {
16
+
17
+ if( 'toplevel_page_wp-chatbot' == $hook ) {
18
+
19
+ wp_enqueue_style( 'wp-color-picker' );
20
+
21
+ wp_enqueue_script( 'htcc_js', plugins_url( 'assets/js/admin.js', HTCC_PLUGIN_FILE ), array( 'wp-color-picker' ), HTCC_VERSION, true );
22
+
23
+
24
+ }
25
+
26
+ }
27
+
28
+ }
29
+
30
+ $htcc_enqueue = new HTCC_Enqueue();
31
+
32
+ add_action('admin_enqueue_scripts', array( $htcc_enqueue, 'enqueue' ) );
33
+
34
+
35
+ endif; // END class_exists check
admin/class-htcc-lang.php CHANGED
@@ -11,34 +11,87 @@ if ( ! class_exists( 'HTCC_Lang' ) ) :
11
  class HTCC_Lang {
12
 
13
  static $fb_lang = array(
14
- 'bn_IN' => 'Bengali',
15
- 'cs_CZ' => 'Czech',
16
- 'zh_CN' => 'Chinese',
17
- 'nl_NL' => 'Dutch',
18
- 'de_DE' => 'German',
19
- 'en_US' => 'English',
20
- 'fr_FR' => 'French',
21
- 'hi_IN' => 'Hindi',
22
- 'he_IL' => 'Hebrew',
23
- 'id_ID' => 'Indonesian',
24
- 'it_IT' => 'Italian',
25
- 'ja_JP' => 'Japanese',
26
- 'ko_KR' => 'Korean',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  'mr_IN' => 'Marathi',
28
- 'pa_IN' => 'Punjabi',
29
- 'pt_PT' => 'Portuguese',
30
- 'pt_BR' => 'Brazil Portuguese',
31
- 'ru_RU' => 'Russian',
32
- 'es_LA' => 'Spanish',
33
- 'ta_IN' => 'Tamil',
34
- 'te_IN' => 'Telugu',
35
- 'th_TH' => 'Thai',
36
- 'tr_TR' => 'Turkish',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  );
38
 
39
 
40
  // http://www.loc.gov/standards/iso639-2/php/code_list.php
41
  // https://developers.facebook.com/docs/internationalization/
 
 
42
 
43
  }
44
 
11
  class HTCC_Lang {
12
 
13
  static $fb_lang = array(
14
+ 'af_ZA' => 'Afrikaans',
15
+ 'sq_AL' => 'Albanian',
16
+ 'hy_AM' => 'Armenian',
17
+ 'ar_AR' => 'Arabic',
18
+ 'az_AZ' => 'Azerbaijani',
19
+ 'be_BY' => 'Belarusian',
20
+ 'bg_BG' => 'Bulgarian *', // tried - not worked
21
+ 'bn_IN' => 'Bengali',
22
+ 'bs_BA' => 'Bosnian',
23
+ 'eu_ES' => 'Basque',
24
+ 'ca_ES' => 'Catalan',
25
+ 'cs_CZ' => 'Czech',
26
+ 'hr_HR' => 'Croatian',
27
+ 'da_DK' => 'Danish',
28
+ 'nl_NL' => 'Dutch',
29
+ 'en_US' => 'English',
30
+ 'eo_EO' => 'Esperanto',
31
+ 'tl_PH' => 'Filipino',
32
+ 'fi_FI' => 'Finnish',
33
+ 'et_EE' => 'Estonian',
34
+ 'fo_FO' => 'Faroese',
35
+ 'fr_FR' => 'French (France)',
36
+ 'fr_CA' => 'French (Canada)',
37
+ 'fy_NL' => 'Frisian',
38
+ 'de_DE' => 'German',
39
+ 'el_GR' => 'Greek',
40
+ 'ka_GE' => 'Georgian *', // tried - not worked
41
+ 'gl_ES' => 'Galician',
42
+ 'he_IL' => 'Hebrew',
43
+ 'hi_IN' => 'Hindi',
44
+ 'hu_HU' => 'Hungarian',
45
+ 'id_ID' => 'Indonesian',
46
+ 'it_IT' => 'Italian',
47
+ 'is_IS' => 'Icelandic',
48
+ 'ga_IE' => 'Irish',
49
+ 'ja_JP' => 'Japanese',
50
+ 'ko_KR' => 'Korean',
51
+ 'ku_TR' => 'Kurdish',
52
+ 'km_KH' => 'Khmer',
53
+ 'la_VA' => 'Latin',
54
+ 'lt_LT' => 'Lithuanian *', // tried - not worked
55
+ 'lv_LV' => 'Latvian *', // tried - not worked
56
  'mr_IN' => 'Marathi',
57
+ 'mk_MK' => 'Macedonian',
58
+ 'ml_IN' => 'Malayalam',
59
+ 'ms_MY' => 'Malay',
60
+ 'nb_NO' => 'Norwegian (bokmal)',
61
+ 'ne_NP' => 'Nepali',
62
+ 'nn_NO' => 'Norwegian (nynorsk)',
63
+ 'fa_IR' => 'Persian',
64
+ 'pa_IN' => 'Punjabi',
65
+ 'pl_PL' => 'Polish',
66
+ 'ps_AF' => 'Pashto',
67
+ 'pt_BR' => 'Portuguese (Brazil)',
68
+ 'pt_PT' => 'Portuguese (Portugal)',
69
+ 'ro_RO' => 'Romanian',
70
+ 'ru_RU' => 'Russian',
71
+ 'es_LA' => 'Spanish',
72
+ 'es_ES' => 'Spanish (Spain)',
73
+ 'sk_SK' => 'Slovak *', // tried - not worked
74
+ 'sl_SI' => 'Slovenian',
75
+ 'sr_RS' => 'Serbian',
76
+ 'sv_SE' => 'Swedish',
77
+ 'sw_KE' => 'Swahili',
78
+ 'ta_IN' => 'Tamil',
79
+ 'te_IN' => 'Telugu',
80
+ 'th_TH' => 'Thai',
81
+ 'tr_TR' => 'Turkish',
82
+ 'uk_UA' => 'Ukrainian',
83
+ 'vi_VN' => 'Vietnamese',
84
+ 'cy_GB' => 'Welsh',
85
+ 'zh_CN' => 'zh_CN Simplified Chinese (China)',
86
+ 'zh_HK' => 'zh_HK Traditional Chinese (Hong Kong)',
87
+ 'zh_TW' => 'zh_TW Traditional Chinese (Taiwan)',
88
  );
89
 
90
 
91
  // http://www.loc.gov/standards/iso639-2/php/code_list.php
92
  // https://developers.facebook.com/docs/internationalization/
93
+ // https://developers.facebook.com/apps/156589268405824/app-details/localize/
94
+ // https://developers.facebook.com/docs/messenger-platform/messenger-profile/supported-locales ( but not all as expected )
95
 
96
  }
97
 
assets/js/admin.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+
5
+ // for support wp-color-picker
6
+
7
+ jQuery(document).ready(function($){
8
+
9
+ $('.htcc-color-wp').wpColorPicker();
10
+
11
+ });
inc/class-htcc-chatbot.php CHANGED
@@ -21,6 +21,12 @@ class HTCC_Chatbot {
21
  $htcc_fb_sdk_lang = esc_attr( $htcc_options['fb_sdk_lang'] );
22
  $htcc_fb_minimized = esc_attr( $htcc_options['minimized'] );
23
  $htcc_fb_ref = esc_attr( $htcc_options['ref'] );
 
 
 
 
 
 
24
 
25
  $shortcode_name = esc_attr( $htcc_options['shortcode'] );
26
  $enable = esc_attr( $htcc_options['enable'] );
@@ -117,12 +123,12 @@ class HTCC_Chatbot {
117
  }
118
 
119
 
120
- $fb_sdk_src = "https://connect.facebook.net/$htcc_fb_sdk_lang/sdk.js"
121
 
122
  ?>
123
 
124
 
125
-
126
  <script>
127
  window.fbAsyncInit = function() {
128
  FB.init({
@@ -144,12 +150,16 @@ class HTCC_Chatbot {
144
 
145
 
146
  <div class="htcc-messenger">
147
- <div class="fb-customerchat"
148
  page_id="<?php echo $htcc_fb_page_id ?>"
149
- ref="<?php echo $htcc_fb_ref ?>"
 
 
 
150
  minimized="<?php echo $htcc_fb_minimized ?>">
151
  </div>
152
  </div>
 
153
 
154
 
155
  <?php
21
  $htcc_fb_sdk_lang = esc_attr( $htcc_options['fb_sdk_lang'] );
22
  $htcc_fb_minimized = esc_attr( $htcc_options['minimized'] );
23
  $htcc_fb_ref = esc_attr( $htcc_options['ref'] );
24
+
25
+
26
+ $htcc_fb_color = esc_attr( $htcc_options['fb_color'] );
27
+ $htcc_fb_greeting_login = esc_attr( $htcc_options['fb_greeting_login'] );
28
+ $htcc_fb_greeting_logout = esc_attr( $htcc_options['fb_greeting_logout'] );
29
+
30
 
31
  $shortcode_name = esc_attr( $htcc_options['shortcode'] );
32
  $enable = esc_attr( $htcc_options['enable'] );
123
  }
124
 
125
 
126
+ $fb_sdk_src = "https://connect.facebook.net/$htcc_fb_sdk_lang/sdk.js";
127
 
128
  ?>
129
 
130
 
131
+ <!-- Add Messenger - wp-chatbot - HoliThemes - https://holithemes.com/ -->
132
  <script>
133
  window.fbAsyncInit = function() {
134
  FB.init({
150
 
151
 
152
  <div class="htcc-messenger">
153
+ <div class="fb-customerchat"
154
  page_id="<?php echo $htcc_fb_page_id ?>"
155
+ theme_color="<?php echo $htcc_fb_color ?>"
156
+ logged_in_greeting="<?php echo $htcc_fb_greeting_login ?>"
157
+ logged_out_greeting="<?php echo $htcc_fb_greeting_logout ?>"
158
+ ref="<?php echo $htcc_fb_ref ?>"
159
  minimized="<?php echo $htcc_fb_minimized ?>">
160
  </div>
161
  </div>
162
+ <!-- / Add Messenger - wp-chatbot - HoliThemes -->
163
 
164
 
165
  <?php
inc/class-htcc-db.php CHANGED
@@ -48,15 +48,19 @@ class HTCC_db {
48
  */
49
  $values = array(
50
  'enable' => '1',
51
- 'fb_app_id' => '510187842699385',
52
- 'fb_page_id' => '135269407170658',
53
  'fb_sdk_lang' => 'en_US',
 
 
 
 
54
 
55
  'list_hideon_pages' => '',
56
  'list_hideon_cat' => '',
57
  'shortcode' => 'chatbot',
58
 
59
- 'minimized' => 'false',
60
  'ref' => '',
61
  );
62
 
48
  */
49
  $values = array(
50
  'enable' => '1',
51
+ 'fb_app_id' => '',
52
+ 'fb_page_id' => '',
53
  'fb_sdk_lang' => 'en_US',
54
+
55
+ 'fb_color' => '',
56
+ 'fb_greeting_login' => '',
57
+ 'fb_greeting_logout' => '',
58
 
59
  'list_hideon_pages' => '',
60
  'list_hideon_cat' => '',
61
  'shortcode' => 'chatbot',
62
 
63
+ 'minimized' => '',
64
  'ref' => '',
65
  );
66
 
inc/class-htcc-register.php CHANGED
@@ -83,6 +83,16 @@ class HTCC_Register {
83
  }
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  }
88
 
83
  }
84
  }
85
 
86
+
87
+ // add settings page links in plugins page - at plugin
88
+ public static function plugin_action_links( $links ) {
89
+ $new_links = array(
90
+ 'settings' => '<a href="' . admin_url( 'admin.php?page=wp-chatbot' ) . '">' . __( 'Settings' , 'wp-chatbot' ) . '</a>',
91
+ );
92
+
93
+ return array_merge( $new_links, $links );
94
+ }
95
+
96
 
97
  }
98
 
inc/class-htcc-shortcode.php CHANGED
@@ -26,6 +26,11 @@ class HTCC_Shortcode {
26
 
27
  $htcc_options = get_option('htcc_options');
28
 
 
 
 
 
 
29
  /**
30
  * min - true or false
31
  */
@@ -34,6 +39,12 @@ class HTCC_Shortcode {
34
  'app_id' => $global_app_id,
35
  'page_id' => $global_page_id,
36
 
 
 
 
 
 
 
37
  'min' => $global_fb_min,
38
  'ref' => $global_fb_ref,
39
 
@@ -43,6 +54,13 @@ class HTCC_Shortcode {
43
  $app_id = $a["app_id"];
44
  $page_id = $a["page_id"];
45
 
 
 
 
 
 
 
 
46
  $min = $a["min"];
47
  $ref = $a["ref"];
48
 
@@ -72,7 +90,10 @@ class HTCC_Shortcode {
72
  $o .= '';
73
  $o .= '<div class="htcc-messenger">
74
  <div class="fb-customerchat"
75
- page_id="'.$page_id.'"
 
 
 
76
  ref="'.$ref.'"
77
  minimized="'.$min.'">
78
  </div>
26
 
27
  $htcc_options = get_option('htcc_options');
28
 
29
+ $htcc_fb_color = esc_attr( $htcc_options['fb_color'] );
30
+ $htcc_fb_greeting_login = esc_attr( $htcc_options['fb_greeting_login'] );
31
+ $htcc_fb_greeting_logout = esc_attr( $htcc_options['fb_greeting_logout'] );
32
+
33
+
34
  /**
35
  * min - true or false
36
  */
39
  'app_id' => $global_app_id,
40
  'page_id' => $global_page_id,
41
 
42
+
43
+ 'color' => $htcc_fb_color,
44
+ 'logged_in_greetings' => $htcc_fb_greeting_login,
45
+ 'logged_out_greetings' => $htcc_fb_greeting_logout,
46
+
47
+
48
  'min' => $global_fb_min,
49
  'ref' => $global_fb_ref,
50
 
54
  $app_id = $a["app_id"];
55
  $page_id = $a["page_id"];
56
 
57
+
58
+ $htcc_fb_color = $a["color"];
59
+ $htcc_fb_greeting_login = $a["logged_in_greetings"];
60
+ $htcc_fb_greeting_logout = $a["logged_out_greetings"];
61
+
62
+
63
+
64
  $min = $a["min"];
65
  $ref = $a["ref"];
66
 
90
  $o .= '';
91
  $o .= '<div class="htcc-messenger">
92
  <div class="fb-customerchat"
93
+ page_id="'.$page_id.'"
94
+ theme_color="' .$htcc_fb_color. '"
95
+ logged_in_greeting="' .$htcc_fb_greeting_login. '"
96
+ logged_out_greeting="' .$htcc_fb_greeting_logout. '"
97
  ref="'.$ref.'"
98
  minimized="'.$min.'">
99
  </div>
inc/commons/variables.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  /**
3
  * Global Variables
4
- *
5
  * @since 1.0
6
  */
7
 
@@ -13,6 +12,12 @@ $htcc_options = get_option('htcc_options');
13
  $GLOBALS["htcc_app_id"] = esc_attr( $htcc_options['fb_app_id'] );
14
  $GLOBALS["htcc_page_id"] = esc_attr( $htcc_options['fb_page_id'] );
15
 
 
 
 
 
 
 
16
  $GLOBALS["htcc_shortcode"] = esc_attr( $htcc_options['shortcode'] );
17
  $GLOBALS["htcc_fb_sdk_lang"] = esc_attr( $htcc_options['fb_sdk_lang'] );
18
 
1
  <?php
2
  /**
3
  * Global Variables
 
4
  * @since 1.0
5
  */
6
 
12
  $GLOBALS["htcc_app_id"] = esc_attr( $htcc_options['fb_app_id'] );
13
  $GLOBALS["htcc_page_id"] = esc_attr( $htcc_options['fb_page_id'] );
14
 
15
+
16
+ // $GLOBALS["htcc_fb_color"] = esc_attr( $htcc_options['fb_color'] );
17
+ // $GLOBALS["htcc_fb_greeting_login"] = esc_attr( $htcc_options['fb_greeting_login'] );
18
+ // $GLOBALS["htcc_fb_greeting_logout"] = esc_attr( $htcc_options['fb_greeting_logout'] );
19
+
20
+
21
  $GLOBALS["htcc_shortcode"] = esc_attr( $htcc_options['shortcode'] );
22
  $GLOBALS["htcc_fb_sdk_lang"] = esc_attr( $htcc_options['fb_sdk_lang'] );
23
 
readme.txt CHANGED
@@ -1,6 +1,6 @@
1
  === WP Chatbot for facebook Messenger ===
2
  Requires at least: 4.6
3
- Tested up to: 4.9.1
4
  Requires PHP: 5.6
5
  Contributors: bhvreddy, holithemes
6
  Donate link: https://www.paypal.me/ugadi
@@ -85,6 +85,11 @@ And for creating automatic messages - use tools like Chatfuel or so..
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
88
  = 2.0 =
89
  * can add ref
90
  * set chat window minimized or not
1
  === WP Chatbot for facebook Messenger ===
2
  Requires at least: 4.6
3
+ Tested up to: 4.9.2
4
  Requires PHP: 5.6
5
  Contributors: bhvreddy, holithemes
6
  Donate link: https://www.paypal.me/ugadi
85
 
86
  == Changelog ==
87
 
88
+ = 2.1 =
89
+ change messenger theme color
90
+ change greetings text for logged in user
91
+ change greetings text for logged out user
92
+
93
  = 2.0 =
94
  * can add ref
95
  * set chat window minimized or not
wp-chatbot.php CHANGED
@@ -1,9 +1,11 @@
1
  <?php
2
  /*
3
- Plugin Name: WP Chatbot for facebook Messenger
 
4
  Description: Add Messenger to your website, Chatbot or live Chat using Facebook Messenger
5
- Version: 2.0
6
- Author: bhvreddy
 
7
  License: GPL2
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
  Text Domain: wp-chatbot
@@ -12,7 +14,7 @@ Text Domain: wp-chatbot
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
- define( 'HTCC_VERSION', '2.0' );
16
  define( 'HTCC_WP_MIN_VERSION', '4.6' );
17
  define( 'HTCC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
18
  define( 'HTCC_PLUGIN_FILE', __FILE__ );
@@ -46,4 +48,6 @@ register_activation_hook( __FILE__, array( 'HTCC_Register', 'activate' ) );
46
  // register_uninstall_hook(__FILE__, array( 'HTCC_Register', 'uninstall' ) );
47
 
48
  // when plugin updated - check version diff
49
- add_action('plugins_loaded', array( 'HTCC_Register', 'plugin_update' ) );
 
 
1
  <?php
2
  /*
3
+ Plugin Name: WP Chatbot
4
+ Plugin URI: https://holithemes.com/wp-chatbot/
5
  Description: Add Messenger to your website, Chatbot or live Chat using Facebook Messenger
6
+ Version: 2.1
7
+ Author: HoliThemes
8
+ Author URI: https://holithemes.com/
9
  License: GPL2
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
  Text Domain: wp-chatbot
14
 
15
  if ( ! defined( 'ABSPATH' ) ) exit;
16
 
17
+ define( 'HTCC_VERSION', '2.1' );
18
  define( 'HTCC_WP_MIN_VERSION', '4.6' );
19
  define( 'HTCC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
20
  define( 'HTCC_PLUGIN_FILE', __FILE__ );
48
  // register_uninstall_hook(__FILE__, array( 'HTCC_Register', 'uninstall' ) );
49
 
50
  // when plugin updated - check version diff
51
+ add_action('plugins_loaded', array( 'HTCC_Register', 'plugin_update' ) );
52
+
53
+ add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( 'HTCC_Register', 'plugin_action_links' ) );