<tbody> <?php while ($wpas_tickets->have_posts()) { $wpas_tickets->the_post(); echo '<tr>'; foreach ($columns as $column_id => $column) { echo '<td'; /* If current column is the date we add the date attribute for sorting purpose */ if ('date' === $column_id) { echo ' data-order="' . strtotime(get_the_time()) . '"'; } /* We don't forget to close the <td> tag */ echo '>'; /* Display the content for this column */ wpas_get_tickets_list_column_content($column_id, $column); echo '</td>'; } echo '</tr>'; } wp_reset_query(); ?> </tbody> </table> <?php wpas_make_button(__('Open a ticket', 'awesome-support'), array('type' => 'link', 'link' => wpas_get_submission_page_url(), 'class' => 'wpas-btn wpas-btn-default')); ?> </div> <?php } else { echo wpas_get_notification_markup('info', sprintf(__('You haven\'t submitted a ticket yet. <a href="%s">Click here to submit your first ticket</a>.', 'awesome-support'), wpas_get_submission_page_url())); }
/** * Display the reply form. * * @since 3.0.0 * @param array $args Additional arguments * @return void */ function wpas_get_reply_form($args = array()) { global $wp_query; $post_id = $wp_query->post->ID; $status = wpas_get_ticket_status($post_id); $defaults = array('form_id' => 'wpas-new-reply', 'form_class' => 'wpas-form', 'container' => 'div', 'container_id' => 'wpas-reply-box', 'container_class' => 'wpas-form-group wpas-wysiwyg-textarea', 'textarea_before' => '', 'textarea_after' => '', 'textarea_class' => 'wpas-form-control wpas-wysiwyg'); $args = wp_parse_args($args, $defaults); /** * Filter the form class. * * This can be useful for addons doing something on the reply form, * like adding an upload feature for instance. * * @since 3.0.0 * @var string */ $form_class = apply_filters('wpas_frontend_reply_form_class', $args['form_class']); /** * wpas_ticket_details_reply_form_before hook * * @since 3.0.0 */ do_action('wpas_ticket_details_reply_form_before'); if ('closed' === $status) { echo wpas_get_notification_markup('info', sprintf(__('The ticket has been closed. If you feel that your issue has not been solved yet or something new came up in relation to this ticket, <a href="%s">you can re-open it by clicking this link</a>.', 'awesome-support'), wpas_get_reopen_url())); /** * Check if the ticket is currently open and if the current user * is allowed to post a reply. */ } elseif ('open' === $status && true === wpas_can_reply_ticket()) { ?> <form id="<?php echo $args['form_id']; ?> " class="<?php echo $form_class; ?> " method="post" action="<?php echo get_permalink($post_id); ?> " enctype="multipart/form-data"> <?php /** * wpas_ticket_details_reply_textarea_before hook * * @since 3.0.0 */ do_action('wpas_ticket_details_reply_textarea_before'); ?> <<?php echo $args['container']; ?> id="<?php echo $args['container_id']; ?> " class="<?php echo $args['container_class']; ?> "> <?php echo $args['textarea_before']; /** * Load the visual editor if enabled */ if (true === boolval(wpas_get_option('frontend_wysiwyg_editor'))) { $editor_defaults = apply_filters('wpas_ticket_editor_args', array('media_buttons' => false, 'textarea_name' => 'wpas_user_reply', 'textarea_rows' => 10, 'tabindex' => 2, 'editor_class' => $args['textarea_class'], 'quicktags' => false, 'tinymce' => array('toolbar1' => 'bold,italic,underline,strikethrough,hr,|,bullist,numlist,|,link,unlink', 'toolbar2' => ''))); wp_editor('', 'wpas-reply-wysiwyg', apply_filters('wpas_reply_wysiwyg_args', $editor_defaults)); } else { /** * Define if the reply can be submitted empty or not. * * @since 3.0.0 * @var boolean */ $can_submit_empty = apply_filters('wpas_can_reply_be_empty', false); ?> <textarea class="form-control" rows="10" name="wpas_user_reply" rows="6" id="wpas-reply-textarea" placeholder="<?php _e('Type your reply here.', 'awesome-support'); ?> " <?php if (false === $can_submit_empty) { ?> required="required"<?php } ?> ></textarea> <?php } echo $args['textarea_after']; ?> </<?php echo $args['container']; ?> > <?php /** * wpas_ticket_details_reply_textarea_after hook * * @since 3.0.0 */ do_action('wpas_ticket_details_reply_textarea_after'); if (current_user_can('close_ticket')) { ?> <div class="checkbox"> <label for="close_ticket" data-toggle="tooltip" data-placement="right" title="" data-original-title="<?php _e('No reply is required to close', 'awesome-support'); ?> "> <input type="checkbox" name="wpas_close_ticket" id="close_ticket" value="true"> <?php _e('Close this ticket', 'awesome-support'); ?> </label> </div> <?php } /** * wpas_ticket_details_reply_close_checkbox_after hook * * @since 3.0.0 */ do_action('wpas_ticket_details_reply_close_checkbox_after'); ?> <input type="hidden" name="ticket_id" value="<?php echo $post_id; ?> " /> <?php wp_nonce_field('send_reply', 'client_reply', false, true); wpas_make_button(__('Reply', 'awesome-support'), array('name' => 'wpas-submit', 'onsubmit' => __('Please Wait...', 'awesome-support'))); /** * wpas_ticket_details_reply_close_checkbox_after hook * * @since 3.0.0 */ do_action('wpas_ticket_details_reply_form_before_close'); ?> </form> <?php /** * This case is an agent viewing the ticket from the front-end. All actions are tracked in the back-end only, that's why we prevent agents from replying through the front-end. */ } elseif ('open' === $status && false === wpas_can_reply_ticket()) { echo wpas_get_notification_markup('info', sprintf(__('To reply to this ticket, please <a href="%s">go to your admin panel</a>.', 'awesome-support'), add_query_arg(array('post' => $post_id, 'action' => 'edit'), admin_url('post.php')))); } else { echo wpas_get_notification_markup('info', __('You are not allowed to reply to this ticket.', 'awesome-support')); } /** * wpas_ticket_details_reply_form_after hook * * @since 3.0.0 */ do_action('wpas_ticket_details_reply_form_after'); }
?> type="password" placeholder="<?php _e('Password'); ?> " id="password" name="pwd" required> </div> <div class="wpas-checkbox"> <label><input type="checkbox" name="pwdshow" id="pwdshow" class="wpas-form-control-checkbox"> <?php echo _x('Show Password', 'Login form', 'wpas'); ?> </label> </div> <?php /** * wpas_after_registration_fields hook * * @Awesome_Support::terms_and_conditions_checkbox() */ do_action('wpas_after_registration_fields'); ?> <input type="hidden" name="wpas_registration" value="true"> <?php wp_nonce_field('register', 'user_registration', false, true); wpas_make_button(__('Create Account', 'wpas'), array('onsubmit' => __('Creating Account...', 'wpas'))); ?> </form> <?php } ?> </div>
/** * The wpas_get_message_textarea will generate the textarea * used to submit the ticket description. It will either generate * a simple textarea or a WYSIWYG editor based on the plugin settings. * * @since 3.0.0 */ wpas_get_message_textarea(); ?> </div> <?php /** * The wpas_submission_form_inside_before hook has to be placed * right before the submission button. * * @since 3.0.0 */ do_action('wpas_submission_form_inside_before_submit'); wp_nonce_field('new_ticket', 'wpas_nonce', false, true); wpas_make_button(__('Submit ticket', 'wpas'), array('name' => 'wpas-submit', 'onsubmit' => __('Please Wait...', 'wpas'))); /** * The wpas_submission_form_inside_before hook has to be placed * right before the form closing tag. * * @since 3.0.0 */ do_action('wpas_submission_form_inside_after'); ?> </form> </div>
_e('Register', 'awesome-support'); ?> </h3> <?php $first_name = new WPAS_Custom_Field('first_name', array('name' => 'first_name', 'args' => array('required' => true, 'field_type' => 'text', 'label' => __('First Name', 'awesome-support'), 'placeholder' => __('First Name', 'awesome-support'), 'sanitize' => 'sanitize_text_field'))); echo $first_name->get_output(); $last_name = new WPAS_Custom_Field('last_name', array('name' => 'last_name', 'args' => array('required' => true, 'field_type' => 'text', 'label' => __('Last Name', 'awesome-support'), 'placeholder' => __('Last Name', 'awesome-support'), 'sanitize' => 'sanitize_text_field'))); echo $last_name->get_output(); $email = new WPAS_Custom_Field('email', array('name' => 'email', 'args' => array('required' => true, 'field_type' => 'email', 'label' => __('Email', 'awesome-support'), 'placeholder' => __('Email', 'awesome-support'), 'sanitize' => 'sanitize_text_field'))); echo $email->get_output(); $pwd = new WPAS_Custom_Field('password', array('name' => 'password', 'args' => array('required' => true, 'field_type' => 'password', 'label' => __('Enter a password', 'awesome-support'), 'placeholder' => __('Password', 'awesome-support'), 'sanitize' => 'sanitize_text_field'))); echo $pwd->get_output(); $showpwd = new WPAS_Custom_Field('pwdshow', array('name' => 'pwdshow', 'args' => array('required' => false, 'field_type' => 'checkbox', 'sanitize' => 'sanitize_text_field', 'options' => array('1' => _x('Show Password', 'Login form', 'awesome-support'))))); echo $showpwd->get_output(); /** * wpas_after_registration_fields hook * * @Awesome_Support::terms_and_conditions_checkbox() */ do_action('wpas_after_registration_fields'); wpas_do_field('register', $redirect_to); wp_nonce_field('register', 'user_registration', false, true); wpas_make_button(__('Create Account', 'awesome-support'), array('onsubmit' => __('Creating Account...', 'awesome-support'))); ?> </form> <?php } ?> </div>
echo '<tr>'; foreach ($columns as $column_id => $column) { echo '<td'; /* If current column is the date we add the date attribute for sorting purpose */ if ('date' === $column_id) { echo ' data-order="' . strtotime(get_the_time()) . '"'; } /* We don't forget to close the <td> tag */ echo '>'; /* Display the content for this column */ wpas_get_tickets_list_column_content($column_id, $column); echo '</td>'; } echo '</tr>'; } wp_reset_query(); ?> </tbody> </table> <?php echo paginate_links(array('base' => str_replace(999999999, '%#%', esc_url(get_pagenum_link(999999999))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wpas_tickets->max_num_pages)); ?> <?php wpas_make_button(__('Open a ticket', 'wpas'), array('type' => 'link', 'link' => esc_url(get_permalink(wpas_get_option('ticket_submit'))), 'class' => 'wpas-btn wpas-btn-default')); ?> </div> <?php } else { wpas_notification('info', sprintf(__('You haven\'t submitted a ticket yet. <a href="%s">Click here to submit your first ticket</a>.', 'wpas'), esc_url(get_permalink(wpas_get_option('ticket_submit'))))); }
* * @since 3.0.0 */ do_action('wpas_submission_form_inside_after_subject'); /** * Filter the description field arguments * * @since 3.2.0 */ $body_args = apply_filters('wpas_description_field_args', array('name' => 'message', 'args' => array('required' => true, 'field_type' => 'wysiwyg', 'label' => __('Description', 'awesome-support'), 'sanitize' => 'sanitize_text_field'))); $body = new WPAS_Custom_Field('message', $body_args); echo $body->get_output(); /** * The wpas_submission_form_inside_before hook has to be placed * right before the submission button. * * @since 3.0.0 */ do_action('wpas_submission_form_inside_before_submit'); wp_nonce_field('new_ticket', 'wpas_nonce', true, true); wpas_make_button(__('Submit ticket', 'awesome-support'), array('name' => 'wpas-submit')); /** * The wpas_submission_form_inside_before hook has to be placed * right before the form closing tag. * * @since 3.0.0 */ do_action('wpas_submission_form_inside_after'); ?> </form> </div>
* * @since 3.0.0 */ do_action('wpas_submission_form_inside_after_subject'); /** * Filter the description field arguments * * @since 3.2.0 */ $body_args = apply_filters('wpas_description_field_args', array('name' => 'message', 'args' => array('required' => true, 'field_type' => 'wysiwyg', 'label' => __('Description', 'wpas'), 'sanitize' => 'sanitize_text_field'))); $body = new WPAS_Custom_Field('message', $body_args); echo $body->get_output(); /** * The wpas_submission_form_inside_before hook has to be placed * right before the submission button. * * @since 3.0.0 */ do_action('wpas_submission_form_inside_before_submit'); wp_nonce_field('new_ticket', 'wpas_nonce', true, true); wpas_make_button(__('Submit ticket', 'wpas'), array('name' => 'wpas-submit')); /** * The wpas_submission_form_inside_before hook has to be placed * right before the form closing tag. * * @since 3.0.0 */ do_action('wpas_submission_form_inside_after'); ?> </form> </div>
<div class="wpas-ticket-buttons-top"> <?php wpas_make_button(__('My Tickets', 'awesome-support'), array('type' => 'link', 'link' => wpas_get_tickets_list_page_url(), 'class' => 'wpas-btn wpas-btn-default wpas-link-ticketlist')); ?> <?php wpas_make_button(__('Open a ticket', 'awesome-support'), array('type' => 'link', 'link' => wpas_get_submission_page_url(), 'class' => 'wpas-btn wpas-btn-default wpas-link-ticketnew')); ?> <?php wpas_make_button(__('Logout', 'awesome-support'), array('type' => 'link', 'link' => wp_logout_url(), 'class' => 'wpas-btn wpas-btn-default wpas-link-logout')); ?> </div>