PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 2.3.1
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v2.3.1
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
supportcandy / includes / admin / settings / get_general_settings.php

get_general_settings.php in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent 2.3.1, at includes/admin/settings/get_general_settings.php

356 lines 19.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5
6 global $current_user;
7 if (!($current_user->ID && $current_user->has_cap('manage_options'))) {
8 exit;
9 }
10 $agent_role = get_option('wpsc_agent_role');
11 ?>
12 <form id="wpsc_frm_general_settings" method="post" action="javascript:wpsc_set_general_settings();">
13
14 <div class="form-group">
15 <label for="wpsc_support_page_id"><?php _e('Support Page','supportcandy');?></label>
16 <p class="help-block"><?php _e('Select page in which shortcode is inserted. Create a page with shortcode [supportcandy] if not created yet. Fullwidth page template is recommended.','supportcandy');?></p>
17 <select class="form-control" name="wpsc_support_page_id" id="wpsc_support_page_id">
18 <option value=""></option>
19 <?php
20 $args = array(
21 'sort_order' => 'asc',
22 'sort_column' => 'post_title',
23 'post_type' => 'page',
24 'post_status' => 'publish'
25 );
26 $wpsc_support_page_id = get_option('wpsc_support_page_id');
27 $pages = get_pages( $args );
28 foreach ( $pages as $page ) :
29 $selected = $wpsc_support_page_id == $page->ID ? 'selected="selected"' : '';
30 echo '<option '.esc_attr($selected).' value="'.$page->ID.'">'.$page->post_title.'</option>';
31 endforeach;
32 ?>
33 </select>
34 <?php
35 $support_page_url = get_permalink($wpsc_support_page_id);
36 ?>
37 <i><small><a href="<?php echo esc_url($support_page_url) ?>" target="_blank"><?php _e('Click here to go to support page','supportcandy')?></a></small></i>
38 </div>
39
40 <div class="form-group">
41 <label for="wpsc_default_ticket_status"><?php _e('Default ticket status','supportcandy');?></label>
42 <p class="help-block"><?php _e('This status will get applied for newly created ticket.','supportcandy');?></p>
43 <select class="form-control" name="wpsc_default_ticket_status" id="wpsc_default_ticket_status">
44 <?php
45 $statuses = get_terms([
46 'taxonomy' => 'wpsc_statuses',
47 'hide_empty' => false,
48 'orderby' => 'meta_value_num',
49 'order' => 'ASC',
50 'meta_query' => array('order_clause' => array('key' => 'wpsc_status_load_order')),
51 ]);
52 $wpsc_default_ticket_status = get_option('wpsc_default_ticket_status');
53 foreach ( $statuses as $status ) :
54 $selected = $wpsc_default_ticket_status == $status->term_id ? 'selected="selected"' : '';
55 echo '<option '.esc_attr($selected).' value="'.esc_attr($status->term_id).'">'.esc_attr($status->name).'</option>';
56 endforeach;
57 ?>
58 </select>
59 </div>
60
61 <div class="form-group">
62 <label for="wpsc_default_ticket_category"><?php _e('Default ticket category','supportcandy');?></label>
63 <p class="help-block"><?php _e('This category will get applied for newly created ticket.','supportcandy');?></p>
64 <select class="form-control" name="wpsc_default_ticket_category" id="wpsc_default_ticket_category">
65 <?php
66 $categories = get_terms([
67 'taxonomy' => 'wpsc_categories',
68 'hide_empty' => false,
69 'orderby' => 'meta_value_num',
70 'order' => 'ASC',
71 'meta_query' => array('order_clause' => array('key' => 'wpsc_category_load_order')),
72 ]);
73 $wpsc_default_ticket_category = get_option('wpsc_default_ticket_category');
74 foreach ( $categories as $category ) :
75 $selected = $wpsc_default_ticket_category == $category->term_id ? 'selected="selected"' : '';
76 echo '<option '.esc_attr($selected).' value="'.esc_attr($category->term_id).'">'.esc_attr($category->name).'</option>';
77 endforeach;
78 ?>
79 </select>
80 </div>
81
82 <div class="form-group">
83 <label for="wpsc_default_ticket_priority"><?php _e('Default ticket priority','supportcandy');?></label>
84 <p class="help-block"><?php _e('This priority will get applied for newly created ticket.','supportcandy');?></p>
85 <select class="form-control" name="wpsc_default_ticket_priority" id="wpsc_default_ticket_priority">
86 <?php
87 $priorities = get_terms([
88 'taxonomy' => 'wpsc_priorities',
89 'hide_empty' => false,
90 'orderby' => 'meta_value_num',
91 'order' => 'ASC',
92 'meta_query' => array('order_clause' => array('key' => 'wpsc_priority_load_order')),
93 ]);
94 $wpsc_default_ticket_priority = get_option('wpsc_default_ticket_priority');
95 foreach ( $priorities as $priority ) :
96 $selected = $wpsc_default_ticket_priority == $priority->term_id ? 'selected="selected"' : '';
97 echo '<option '.esc_attr($selected).' value="'.esc_attr($priority->term_id).'">'.esc_attr($priority->name).'</option>';
98 endforeach;
99 ?>
100 </select>
101 </div>
102
103 <div class="form-group">
104 <label for="wpsc_ticket_status_after_customer_reply"><?php _e('Ticket status after customer reply','supportcandy');?></label>
105 <p class="help-block"><?php _e("This status will be applied to the ticket if customer post reply in ticket. 'Default' will not change status of the ticket in this case.","supportcandy");?></p>
106 <select class="form-control" name="wpsc_ticket_status_after_customer_reply" id="wpsc_ticket_status_after_customer_reply">
107 <option value=""><?php _e('Default','supportcandy');?></option>
108 <?php
109 $wpsc_ticket_status_after_customer_reply = get_option('wpsc_ticket_status_after_customer_reply');
110 foreach ( $statuses as $status ) :
111 $selected = $wpsc_ticket_status_after_customer_reply == $status->term_id ? 'selected="selected"' : '';
112 echo '<option '.esc_attr($selected).' value="'.esc_attr($status->term_id).'">'.esc_attr($status->name).'</option>';
113 endforeach;
114 ?>
115 </select>
116 </div>
117
118 <div class="form-group">
119 <label for="wpsc_ticket_status_after_agent_reply"><?php _e('Ticket status after agent reply','supportcandy');?></label>
120 <p class="help-block"><?php _e("This status will be applied to the ticket if agent or any support staff post reply in ticket. 'Default' will not change status of the ticket in this case.","supportcandy");?></p>
121 <select class="form-control" name="wpsc_ticket_status_after_agent_reply" id="wpsc_ticket_status_after_agent_reply">
122 <option value=""><?php _e('Default','supportcandy');?></option>
123 <?php
124 $wpsc_ticket_status_after_agent_reply = get_option('wpsc_ticket_status_after_agent_reply');
125 foreach ( $statuses as $status ) :
126 $selected = $wpsc_ticket_status_after_agent_reply == $status->term_id ? 'selected="selected"' : '';
127 echo '<option '.esc_attr($selected).' value="'.esc_attr($status->term_id).'">'.esc_attr($status->name).'</option>';
128 endforeach;
129 ?>
130 </select>
131 </div>
132
133 <div class="form-group">
134 <label for="wpsc_close_ticket_status"><?php _e('Close ticket status','supportcandy');?></label>
135 <p class="help-block"><?php _e("Status to apply if 'Close Ticket' button clicked for a ticket.","supportcandy");?></p>
136 <select class="form-control" name="wpsc_close_ticket_status" id="wpsc_close_ticket_status">
137 <?php
138 $wpsc_close_ticket_status = get_option('wpsc_close_ticket_status');
139 foreach ( $statuses as $status ) :
140 $selected = $wpsc_close_ticket_status == $status->term_id ? 'selected="selected"' : '';
141 echo '<option '.esc_attr($selected).' value="'.esc_attr($status->term_id).'">'.esc_attr($status->name).'</option>';
142 endforeach;
143 ?>
144 </select>
145 </div>
146
147 <div class="form-group">
148 <label for="wpsc_allow_customer_close_ticket"><?php _e('Allow customer to close ticket','supportcandy');?></label>
149 <p class="help-block"><?php _e("Enables 'Close Ticket' button for customer inside open ticket screen.","supportcandy");?></p>
150 <select class="form-control" name="wpsc_allow_customer_close_ticket" id="wpsc_allow_customer_close_ticket">
151 <?php
152 $wpsc_allow_customer_close_ticket = get_option('wpsc_allow_customer_close_ticket');
153 $selected = $wpsc_allow_customer_close_ticket == '1' ? 'selected="selected"' : '';
154 echo '<option '.esc_attr($selected).' value="1">'.__('Yes','supportcandy').'</option>';
155 $selected = $wpsc_allow_customer_close_ticket == '0' ? 'selected="selected"' : '';
156 echo '<option '.esc_attr($selected).' value="0">'.__('No','supportcandy').'</option>';
157 ?>
158 </select>
159 </div>
160
161 <div class="form-group">
162 <label for="wpsc_reply_form_position"><?php _e('Reply form position','supportcandy');?></label>
163 <p class="help-block"><?php _e("Reply form position in open ticket page. 'Top' will load reply form above ticket threads and ticket threads will load in decending order. Whereas, 'Bottom' will load reply form below ticket thread and threads loaded in acending order.","supportcandy");?></p>
164 <select class="form-control" name="wpsc_reply_form_position" id="wpsc_reply_form_position">
165 <?php
166 $wpsc_reply_form_position = get_option('wpsc_reply_form_position');
167 $selected = $wpsc_reply_form_position == '1' ? 'selected="selected"' : '';
168 echo '<option '.esc_attr($selected).' value="1">'.__('Top','supportcandy').'</option>';
169 $selected = $wpsc_reply_form_position == '0' ? 'selected="selected"' : '';
170 echo '<option '.esc_attr($selected).' value="0">'.__('Bottom','supportcandy').'</option>';
171 ?>
172 </select>
173 </div>
174
175 <div class="form-group">
176 <label for="wpsc_calender_date_format"><?php _e('Calender date format','supportcandy');?></label>
177 <p class="help-block"><?php _e("This format will be applicable for input date fields (datepicker) for SupportCandy.","supportcandy");?></p>
178 <select class="form-control" name="wpsc_calender_date_format" id="wpsc_calender_date_format">
179 <?php
180 $wpsc_calender_date_format = get_option('wpsc_calender_date_format');
181 $selected = $wpsc_calender_date_format == 'dd-mm-yy' ? 'selected="selected"' : '';
182 echo '<option '.esc_attr($selected).' value="dd-mm-yy">dd-mm-yy</option>';
183 $selected = $wpsc_calender_date_format == 'mm-dd-yy' ? 'selected="selected"' : '';
184 echo '<option '.esc_attr($selected).' value="mm-dd-yy">mm-dd-yy</option>';
185 $selected = $wpsc_calender_date_format == 'yy-mm-dd' ? 'selected="selected"' : '';
186 echo '<option '.esc_attr($selected).' value="yy-mm-dd">yy-mm-dd</option>';
187 $selected = $wpsc_calender_date_format == 'yy-dd-mm' ? 'selected="selected"' : '';
188 echo '<option '.esc_attr($selected).' value="yy-dd-mm">yy-dd-mm</option>';
189 $selected = $wpsc_calender_date_format == 'mm-yy-dd' ? 'selected="selected"' : '';
190 echo '<option '.esc_attr($selected).' value="mm-yy-dd">mm-yy-dd</option>';
191 $selected = $wpsc_calender_date_format == 'dd-yy-mm' ? 'selected="selected"' : '';
192 echo '<option '.esc_attr($selected).' value="dd-yy-mm">dd-yy-mm</option>';
193 ?>
194 </select>
195 </div>
196
197 <div class="form-group">
198 <label for="wpsc_ticket_alice"><?php _e('Ticket Alice in Email Notification Subject','supportcandy' );?></label>
199 <p class="help-block"><?php _e("Label to represent ticket in email notification subject etc e.g. You may want to use this as a bug tracking then you can label it like issue #123, bug #132 etc. So that it should be show in issue #123 or Bug #123. Please note this will only work in email subject. If you want to change all places, you will need to translate .pot","supportcandy");?></p>
200 <input type="text" class="form-control" name="wpsc_ticket_alice" id="wpsc_ticket_alice" value="<?php echo esc_attr(get_option('wpsc_ticket_alice'));?>" />
201 </div>
202
203 <div class="form-group">
204 <label for="wpsc_allow_ct"><?php _e('Allow to create new tickets','supportcandy');?></label>
205 <p class="help-block"><?php _e("Only selected roles can create new tickets. Enables guest ticket facility. Guest will able to create ticket without needing them to have an user account on website. They can create ticket using their name and email address.","supportcandy");?></p>
206 <div class="row"><?php
207 $wpsc_allow_to_create_ticket = get_option('wpsc_allow_to_create_ticket');
208 $wpsc_allow_to_create_ticket = $wpsc_allow_to_create_ticket ? $wpsc_allow_to_create_ticket : array();
209 foreach($agent_role as $key => $val):
210 $checked = in_array($key,$wpsc_allow_to_create_ticket) ? 'checked="checked"' : '';?>
211 <div class="col-sm-4" style="margin-bottom:10px; display:flex;">
212 <div style="width:25px;"><input type="checkbox" name="wpsc_allow_to_create_ticket[]" <?php echo esc_attr($checked)?> value="<?php echo esc_attr($key)?>" /></div>
213 <div style="padding-top:3px;"><?php echo esc_attr($val['label'])?></div>
214 </div>
215 <?php
216 endforeach;
217 $ct_customer = in_array('customer',$wpsc_allow_to_create_ticket) ? 'checked="checked"' : '';
218 $ct_guest = in_array('guest',$wpsc_allow_to_create_ticket) ? 'checked="checked"' : '';
219 ?>
220 <div class="col-sm-4" style="margin-bottom:10px; display:flex;">
221 <div style="width:25px;"><input type="checkbox" name="wpsc_allow_to_create_ticket[]" <?php echo esc_attr($ct_customer)?> value="customer" /></div>
222 <div style="padding-top:3px;"><?php _e('Customer','supportcandy')?></div>
223 </div>
224 <div class="col-sm-4" style="margin-bottom:10px; display:flex;">
225 <div style="width:25px;"><input type="checkbox" name="wpsc_allow_to_create_ticket[]" <?php echo esc_attr($ct_guest)?> value="guest" /></div>
226 <div style="padding-top:3px;"><?php _e('Guest','supportcandy')?></div>
227 </div>
228 </div>
229 </div>
230
231 <div class="form-group">
232 <?php
233 $reply_to_close_ticket = get_option('wpsc_allow_reply_to_close_ticket');
234 ?>
235 <label for="wpsc_allow_attach"><?php _e('Allow Reply to Closed Tickets','supportcandy');?></label>
236 <p class="help-block"><?php _e("Only selected roles can reply to closed tickets. The tickets having status selected in the closed ticket group will be considered as close tickets.","supportcandy");?></p>
237 <div class="row">
238 <div class="col-sm-4" style="margin-bottom:10px; display:flex;">
239 <?php $checked = in_array('customer', $reply_to_close_ticket) ? 'checked="checked"' : '';?>
240 <div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="checkbox" name="wpsc_allow_rtct[]" value="customer" /></div>
241 <div style="padding-top:3px;"><?php _e('Customers','supportcandy') ?></div>
242 </div>
243 <div class="col-sm-4" style="margin-bottom:10px; display:flex;">
244 <?php $checked = in_array('agents', $reply_to_close_ticket) ? 'checked="checked"' : '';?>
245 <div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="checkbox" name="wpsc_allow_rtct[]" value="agents" /></div>
246 <div style="padding-top:3px;"><?php _e('Agents','supportcandy') ?></div>
247 </div>
248 </div>
249 </div>
250
251 <div class="form-group">
252 <label for="wpsc_default_login_setting"><?php _e('Default Login','supportcandy');?></label><br />
253 <p class="help-block"><?php _e(" Default Login on support page.","supportcandy");?></p>
254 <select class="form-control" name="wpsc_default_login_setting" id="wpsc_default_login_setting">
255 <?php
256 $wpsc_enable_default_login = get_option('wpsc_default_login_setting');
257
258 $selected = $wpsc_enable_default_login == '1' ? 'selected="selected"' : '';
259 echo '<option '.esc_attr($selected).' value="1">Support Candy Login form</option>';
260
261 $selected = $wpsc_enable_default_login == '2' ? 'selected="selected"' : '';
262 echo '<option '.esc_attr($selected).' value="2">WordPress Login Link</option>';
263
264 $selected = $wpsc_enable_default_login == '3' ? 'selected="selected"' : '';
265 echo '<option '.esc_attr($selected).' value="3">Custom Login URL</option>';
266 ?>
267 </select>
268
269 <div id="custom_login" style="display:none;">
270 <label style="margin-top:10px"><?php _e('Custom Url','supportcandy');?></label>
271 <input type="text" class="form-control" style="width:500px; margin-top:8px;" name="wpsc_custom_login_url" value="<?php echo esc_attr(get_option('wpsc_custom_login_url')); ?>"><br>
272 </div>
273
274 </div>
275 <div class="form-group">
276 <label for="wpsc_user_registration"><?php _e('User Registration','supportcandy');?></label>
277 <p class="help-block"></p>
278 <select class="form-control" name="wpsc_user_registration" id="wpsc_user_registration">
279 <?php
280 $wpsc_user_registration = get_option('wpsc_user_registration');
281 $selected = $wpsc_user_registration == '1' ? 'selected="selected"' : '';
282 echo '<option '.esc_attr($selected).' value="1">'.__('Enable','supportcandy').'</option>';
283 $selected = $wpsc_user_registration == '0' ? 'selected="selected"' : '';
284 echo '<option '.esc_attr($selected).' value="0">'.__('Disable','supportcandy').'</option>';
285 ?>
286 </select>
287 </div>
288 <div class="form-group">
289 <label for="wpsc_user_registration_method"><?php _e('User Registration Method','supportcandy');?></label>
290 <p class="help-block"></p>
291 <select class="form-control" name="wpsc_user_registration_method" id="wpsc_user_registration_method">
292 <?php
293 $wpsc_user_registration_method=get_option('wpsc_user_registration_method');
294
295 $selected = $wpsc_user_registration_method == '1' ? 'selected="selected"' : '';
296 echo '<option '.esc_attr($selected).' value="1">Support Candy Registration </option>';
297
298 $selected = $wpsc_user_registration_method == '2' ? 'selected="selected"' : '';
299 echo '<option '.esc_attr($selected).' value="2">WordPress Default Registration</option>';
300
301 $selected = $wpsc_user_registration_method == '3' ? 'selected="selected"' : '';
302 echo '<option '.esc_attr($selected).' value="3">Custom Registration URL</option>';
303
304 ?>
305
306 </select>
307 <div id="custom_registration" style="display:none;">
308 <label style="margin-top:10px"><?php _e('Custom Url','supportcandy');?></label>
309 <input type="text" class="form-control" style="width:500px; margin-top:8px;" name="wpsc_custom_registration_url" value="<?php echo esc_attr(get_option('wpsc_custom_registration_url')); ?>"><br>
310 </div>
311
312 </div>
313
314 <?php do_action('wpsc_get_gerneral_settings');?>
315
316 <button type="submit" class="btn btn-success"><?php _e('Save Changes','supportcandy');?></button>
317 <img class="wpsc_submit_wait" style="display:none;" src="<?php echo esc_url(WPSC_PLUGIN_URL.'asset/images/[email protected]');?>">
318 <input type="hidden" name="action" value="wpsc_settings" />
319 <input type="hidden" name="setting_action" value="set_general_settings" />
320 <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce('set_general_settings')?>">
321 </form>
322
323 <script>
324 jQuery(document).ready(function() {
325
326 <?php
327 if($wpsc_enable_default_login == 3){
328 ?>
329 jQuery('#custom_login').show();
330 <?php
331 }
332 if($wpsc_user_registration_method==3)
333 {
334 ?>
335 jQuery('#custom_registration').show();
336 <?php
337 }
338 ?>
339
340 jQuery('#wpsc_user_registration_method').change(function() {
341 if(this.value=='3'){
342 jQuery('#custom_registration').show();
343 }else {
344 jQuery('#custom_registration').hide();
345 }
346 });
347 jQuery('#wpsc_default_login_setting').change(function() {
348 if(this.value=='3'){
349 jQuery('#custom_login').show();
350 }else {
351 jQuery('#custom_login').hide();
352 }
353 });
354 });
355 </script>
356