| 1 |
<?php |
| 2 |
add_filter( 'wpas_plugin_settings', 'wpas_core_settings_general', 5, 1 ); |
| 3 |
/** |
| 4 |
* Add plugin core settings. |
| 5 |
* |
| 6 |
* @param array $def Array of existing settings |
| 7 |
* |
| 8 |
* @return array Updated settings |
| 9 |
*/ |
| 10 |
function wpas_core_settings_general( $def ) { |
| 11 |
|
| 12 |
$user_registration = boolval( get_option( 'users_can_register' ) ); |
| 13 |
$registration_lbl = ( true === $user_registration ) ? _x( 'allowed', 'User registration is allowed', 'awesome-support' ) : _x( 'not allowed', 'User registration is not allowed', 'awesome-support' ); |
| 14 |
|
| 15 |
// translators: %s is the shortcode value. |
| 16 |
$desc = __( 'The page used for ticket submission. This page should contain the shortcode %s', 'awesome-support' ); |
| 17 |
|
| 18 |
// translators: %s is the shortcode value. |
| 19 |
$desc1 = __( 'The page that will list all tickets for a client. This page should contain the shortcode %s', 'awesome-support' ); |
| 20 |
|
| 21 |
$settings = array( |
| 22 |
'general' => array( |
| 23 |
'name' => __( 'General', 'awesome-support' ), |
| 24 |
'options' => array( |
| 25 |
array( |
| 26 |
'name' => __( 'General Admin and Agent Options', 'awesome-support' ), |
| 27 |
'type' => 'heading', |
| 28 |
), |
| 29 |
array( |
| 30 |
'name' => __( 'Default Assignee', 'awesome-support' ), |
| 31 |
'id' => 'assignee_default', |
| 32 |
'type' => 'select', |
| 33 |
'desc' => __( 'Who to assign tickets to in the case that auto-assignment wouldn't work. This does NOT mean that all tickets will be assigned to this user. This is a fallback option. To enable/disable auto assignment for an agent, please do so in the user profile settings.', 'awesome-support' ), |
| 34 |
'options' => isset( $_GET['post_type'] ) && 'ticket' === $_GET['post_type'] && isset( $_GET['page'] ) && 'wpas-settings' === $_GET['page'] ? wpas_list_users( 'edit_ticket' ) : array(), |
| 35 |
'default' => '' |
| 36 |
), |
| 37 |
array( |
| 38 |
'name' => __( 'Use SELECT2 For Staff Drop-downs', 'awesome-support' ), |
| 39 |
'id' => "support_staff_select2_enabled", |
| 40 |
'type' => 'checkbox', |
| 41 |
'default' => false, |
| 42 |
'desc' => __( 'On ticket screen turn the staff dropdown into select2 box.', 'awesome-support' ) |
| 43 |
), |
| 44 |
array( |
| 45 |
'name' => __( 'Replies Order', 'awesome-support' ), |
| 46 |
'id' => 'replies_order', |
| 47 |
'type' => 'radio', |
| 48 |
'desc' => __( 'In which order should the replies be displayed (for both client and admin side)?', 'awesome-support' ), |
| 49 |
'options' => array( 'ASC' => __( 'Old to New', 'awesome-support' ), 'DESC' => __( 'New to Old', 'awesome-support' ) ), |
| 50 |
'default' => 'ASC' |
| 51 |
), |
| 52 |
array( |
| 53 |
'name' => __( 'Replies Per Page', 'awesome-support' ), |
| 54 |
'id' => 'replies_per_page', |
| 55 |
'type' => 'text', |
| 56 |
'default' => 10, |
| 57 |
'desc' => __( 'How many replies should be displayed per page on a ticket details screen?', 'awesome-support' ) |
| 58 |
), |
| 59 |
array( |
| 60 |
'name' => __( 'Hide Closed Tickets', 'awesome-support' ), |
| 61 |
'id' => 'hide_closed', |
| 62 |
'type' => 'checkbox', |
| 63 |
'desc' => __( 'Only show open tickets when agents click the "All Tickets" link.', 'awesome-support' ), |
| 64 |
'default' => true |
| 65 |
), |
| 66 |
array( |
| 67 |
'name' => __( 'Show Count', 'awesome-support' ), |
| 68 |
'id' => 'show_count', |
| 69 |
'type' => 'checkbox', |
| 70 |
'desc' => __( 'Display the number of open tickets in the admin menu.', 'awesome-support' ), |
| 71 |
'default' => true |
| 72 |
), |
| 73 |
array( |
| 74 |
'name' => __( 'Old Tickets', 'awesome-support' ), |
| 75 |
'id' => 'old_ticket', |
| 76 |
'type' => 'text', |
| 77 |
'default' => 10, |
| 78 |
'desc' => __( 'After how many days should a ticket be considered «old»?', 'awesome-support' ) |
| 79 |
), |
| 80 |
array( |
| 81 |
'name' => __( 'Automatically change ticket status when assigned', 'awesome-support' ), |
| 82 |
'id' => 'turn_auto_change_status', |
| 83 |
'type' => 'checkbox', |
| 84 |
'desc' => __( 'When the ticket asignee is changed, the status is change to `In Progress`.', 'awesome-support' ), |
| 85 |
'default' => true |
| 86 |
), |
| 87 |
|
| 88 |
array( |
| 89 |
'name' => __( 'Front-end Options', 'awesome-support' ), |
| 90 |
'type' => 'heading', |
| 91 |
'desc' => __( 'These settings control the user experience when they submit or view their tickets', 'awesome-support' ), |
| 92 |
), |
| 93 |
array( |
| 94 |
'name' => __( 'Tickets Per Page', 'awesome-support' ), |
| 95 |
'id' => 'tickets_per_page_front_end', |
| 96 |
'type' => 'text', |
| 97 |
'default' => 5, |
| 98 |
'desc' => __( 'How many tickets per page should be displayed to the customer/client/end-user?', 'awesome-support' ), |
| 99 |
), |
| 100 |
array( |
| 101 |
'name' => __( 'Hide Closed Tickets', 'awesome-support' ), |
| 102 |
'id' => 'hide_closed_fe', |
| 103 |
'type' => 'checkbox', |
| 104 |
'desc' => __( 'Only show open tickets to clients on the front-end.', 'awesome-support' ), |
| 105 |
'default' => false |
| 106 |
), |
| 107 |
array( |
| 108 |
'name' => __( 'Hide Ticket ID', 'awesome-support' ), |
| 109 |
'id' => 'hide_ticket_id_title_fe', |
| 110 |
'type' => 'checkbox', |
| 111 |
'desc' => __( 'Do not show the ticket id in the title when viewing the ticket list', 'awesome-support' ), |
| 112 |
'default' => false |
| 113 |
), |
| 114 |
array( |
| 115 |
'name' => __( 'Show Close Ticket Checkbox', 'awesome-support' ), |
| 116 |
'id' => 'allow_user_to_close_tickets', |
| 117 |
'type' => 'checkbox', |
| 118 |
'desc' => __( 'Show the checkbox that allow users to close tickets. This affects ALL users. (If you would like to restrict closing tickets to only some users, use WordPress roles and the close_ticket capability instead.)', 'awesome-support' ), |
| 119 |
'default' => true |
| 120 |
), |
| 121 |
array( |
| 122 |
'name' => __( 'Maximum Lenght in the Ticket Subject', 'awesome-support' ), |
| 123 |
'id' => 'maximum_ticket_subject_front_end', |
| 124 |
'type' => 'text', |
| 125 |
'default' => 0, |
| 126 |
'desc' => __( 'Set the Maximum Lenght in the Ticket Subject field of the Submit Ticket Form on the front-end.', 'awesome-support' ), |
| 127 |
), |
| 128 |
|
| 129 |
/* Notification buttons */ |
| 130 |
array( |
| 131 |
'name' => __( 'Notification Button', 'awesome-support' ), |
| 132 |
'desc' => __( 'Options for the notification button at the top of the single ticket screen on the front-end', 'awesome-support' ), |
| 133 |
'type' => 'heading', |
| 134 |
), |
| 135 |
array( |
| 136 |
'name' => __( 'Enable', 'awesome-support' ), |
| 137 |
'id' => 'enable_notification_button', |
| 138 |
'type' => 'checkbox', |
| 139 |
'default' => true, |
| 140 |
'desc' => __( 'Show the notification button on the front-end?', 'awesome-support' ) |
| 141 |
), |
| 142 |
array( |
| 143 |
'name' => __( 'Button Label', 'awesome-support' ), |
| 144 |
'desc' => __( 'This is the label for the button', 'awesome-support' ), |
| 145 |
'id' => 'notifications_button_label', |
| 146 |
'type' => 'text', |
| 147 |
'default' => __( 'Notifications', 'awesome-support' ), |
| 148 |
), |
| 149 |
array( |
| 150 |
'name' => __( 'Content', 'awesome-support' ), |
| 151 |
'desc' => __( 'This is the message that the user will see when they click the notifications button', 'awesome-support' ), |
| 152 |
'id' => 'notifications_button_msg', |
| 153 |
'type' => 'editor', |
| 154 |
'settings' => array( 'quicktags' => true, 'textarea_rows' => 7 ), |
| 155 |
'default' => __( 'You are receiving the default standard notifications for this ticket. Among others, they include replies from agents, a notification when the ticket is closed, a notification if the ticket is reopened by the agent and a confirmation when the ticket was first submitted. ', 'awesome-support' ), |
| 156 |
), |
| 157 |
|
| 158 |
array( |
| 159 |
'name' => __( 'Redirects', 'awesome-support' ), |
| 160 |
'type' => 'heading', |
| 161 |
'desc' => __( 'Configure where the user should be sent after certain actions', 'awesome-support' ), |
| 162 |
), |
| 163 |
array( |
| 164 |
'name' => __( 'Logout Redirect', 'awesome-support' ), |
| 165 |
'id' => 'logout_redirect_fe', |
| 166 |
'type' => 'text', |
| 167 |
'desc' => __( 'When the user clicks the logout button on an Awesome Support page, where should they be redirected to? Enter the FULL url starting with http or https.', 'awesome-support' ), |
| 168 |
), |
| 169 |
array( |
| 170 |
'name' => __( 'New Ticket Redirect', 'awesome-support' ), |
| 171 |
'id' => 'new_ticket_redirect_fe', |
| 172 |
'type' => 'text', |
| 173 |
'desc' => __( 'After the user enters a new ticket they are usually taken to the newly entered ticket. But, if you would like to redirect them someplace else, enter that location here. Enter the FULL url starting with http or https.', 'awesome-support' ), |
| 174 |
), |
| 175 |
array( |
| 176 |
'name' => __( 'New Ticket Form Redirect', 'awesome-support' ), |
| 177 |
'id' => 'new_ticket_form_redirect_fe', |
| 178 |
'type' => 'text', |
| 179 |
'desc' => __( 'If you would like to use a custom form for your new ticket form but still use our login screen then enter the full URL to the custom form. An example where this would be useful would be if you are using a Gravity Form in conjunction with our Gravity Form bridge. Enter the FULL url starting with http or https. Note that if you use this option you will never be able to see or use our standard ticket form! ', 'awesome-support' ), |
| 180 |
), |
| 181 |
|
| 182 |
array( |
| 183 |
'name' => __( 'Toolbars', 'awesome-support' ), |
| 184 |
'type' => 'heading', |
| 185 |
'desc' => __( 'Control whether certain toolbars are visible to agents', 'awesome-support' ), |
| 186 |
), |
| 187 |
array( |
| 188 |
'name' => __( 'Show Ticket Details Toolbar', 'awesome-support' ), |
| 189 |
'id' => 'ticket_detail_show_toolbar', |
| 190 |
'type' => 'checkbox', |
| 191 |
'default' => true, |
| 192 |
'desc' => __( 'Show the toolbar on the ticket detail screen when an agent is viewing the ticket?', 'awesome-support' ), |
| 193 |
), |
| 194 |
|
| 195 |
array( |
| 196 |
'name' => __( 'Plugin Pages', 'awesome-support' ), |
| 197 |
'type' => 'heading', |
| 198 |
'desc' => __( 'Configure pages where tickets will be displayed - we take special actions when these pages are viewed by the user', 'awesome-support' ), |
| 199 |
), |
| 200 |
array( |
| 201 |
'name' => __( 'Ticket Submission', 'awesome-support' ), |
| 202 |
'id' => 'ticket_submit', |
| 203 |
'type' => 'select', |
| 204 |
'multiple' => true, |
| 205 |
'desc' => sprintf( $desc, '<code>[ticket-submit]</code>' ), |
| 206 |
'options' => wpas_list_pages(), |
| 207 |
'default' => '' |
| 208 |
), |
| 209 |
array( |
| 210 |
'name' => __( 'Tickets List', 'awesome-support' ), |
| 211 |
'id' => 'ticket_list', |
| 212 |
'type' => 'select', |
| 213 |
'multiple' => false, |
| 214 |
'desc' => sprintf( $desc1, '<code>[tickets]</code>' ), |
| 215 |
'options' => wpas_list_pages(), |
| 216 |
'default' => '' |
| 217 |
), |
| 218 |
|
| 219 |
array( |
| 220 |
'name' => __( 'Misc', 'awesome-support' ), |
| 221 |
'type' => 'heading', |
| 222 |
), |
| 223 |
|
| 224 |
array( |
| 225 |
'name' => __( 'Credit', 'awesome-support' ), |
| 226 |
'type' => 'heading', |
| 227 |
), |
| 228 |
array( |
| 229 |
'name' => __( 'Show Credit', 'awesome-support' ), |
| 230 |
'id' => 'credit_link', |
| 231 |
'type' => 'checkbox', |
| 232 |
'desc' => __( 'Do you like this plugin? Please help us spread the word by displaying a credit link at the bottom of your ticket submission page.', 'awesome-support' ), |
| 233 |
'default' => false |
| 234 |
), |
| 235 |
array( |
| 236 |
'name' => __( 'Admin Rating Request', 'awesome-support' ), |
| 237 |
'id' => 'remove_admin_ratings_request', |
| 238 |
'type' => 'checkbox', |
| 239 |
'desc' => __( 'Remove the rating request footer in the admin screen.', 'awesome-support' ), |
| 240 |
'default' => false |
| 241 |
), |
| 242 |
) |
| 243 |
), |
| 244 |
); |
| 245 |
|
| 246 |
return array_merge( $def, apply_filters('wpas_settings_general', $settings ) ); |
| 247 |
|
| 248 |
} |
| 249 |
|