/**
  * Redirect ticket archive page.
  *
  * We don't use the archive page to display the ticket
  * so let's redirect it to the user's tickets list instead.
  *
  * @since  1.0.0
  * @return void
  */
 public function redirect_archive()
 {
     if (is_post_type_archive('ticket')) {
         wpas_redirect('archive_redirect', wpas_get_tickets_list_page_url());
     }
 }
/**
 * Trigger the re-open ticket function
 *
 * This is triggered by the wpas_do custom actions.
 *
 * @since 3.3
 *
 * @param array $data Superglobal data
 *
 * @return void
 */
function wpas_reopen_ticket_trigger($data)
{
    if (isset($data['ticket_id'])) {
        $ticket_id = (int) $data['ticket_id'];
        if (!wpas_can_submit_ticket($ticket_id) && !current_user_can('edit_ticket')) {
            wpas_add_error('cannot_reopen_ticket', __('You are not allowed to re-open this ticket', 'awesome-support'));
            wpas_redirect('ticket_reopen', wpas_get_tickets_list_page_url());
            exit;
        }
        wpas_reopen_ticket($ticket_id);
        wpas_add_notification('ticket_reopen', __('The ticket has been successfully re-opened.', 'awesome-support'));
        wpas_redirect('ticket_reopen', wp_sanitize_redirect(get_permalink($ticket_id)));
        exit;
    }
}
/**
 * Redirect ticket archive page.
 *
 * We don't use the archive page to display the ticket
 * so let's redirect it to the user's tickets list instead.
 *
 * @since  1.0.0
 * @return void
 */
function wpas_redirect_ticket_archive()
{
    if (is_post_type_archive('ticket')) {
        // Redirect to the tickets list page
        $redirect_to = wpas_get_tickets_list_page_url();
        // Fallback to the ticket submission page
        if (empty($redirect_to)) {
            $redirect_to = wpas_get_submission_page_url();
        }
        // Fallback to the site homepage
        if (empty($redirect_to)) {
            $redirect_to = home_url();
        }
        wpas_redirect('archive_redirect', $redirect_to);
    }
}
Esempio n. 4
0
if ('disallow' === $registration) {
    echo wpas_get_notification_markup('failure', __('Registrations are currently not allowed.', 'awesome-support'));
}
$username = new WPAS_Custom_Field('log', array('name' => 'log', 'args' => array('required' => true, 'field_type' => 'text', 'label' => __('E-mail or username', 'awesome-support'), 'placeholder' => __('E-mail or username', 'awesome-support'), 'sanitize' => 'sanitize_text_field')));
echo $username->get_output();
$password = new WPAS_Custom_Field('pwd', array('name' => 'pwd', 'args' => array('required' => true, 'field_type' => 'password', 'label' => __('Password', 'awesome-support'), 'placeholder' => __('Password', 'awesome-support'), 'sanitize' => 'sanitize_text_field')));
echo $password->get_output();
/**
 * wpas_after_login_fields hook
 */
do_action('wpas_after_login_fields');
$rememberme = new WPAS_Custom_Field('rememberme', array('name' => 'rememberme', 'args' => array('required' => true, 'field_type' => 'checkbox', 'sanitize' => 'sanitize_text_field', 'options' => array('1' => __('Remember Me', 'awesome-support')))));
echo $rememberme->get_output();
wpas_do_field('login', $redirect_to);
wpas_make_button(__('Log in'), array('onsubmit' => __('Logging In...', 'awesome-support')));
printf('<a href="%1$s" class="wpas-forgot-password-link">%2$s</a>', wp_lostpassword_url(wpas_get_tickets_list_page_url()), esc_html__('Forgot password?', 'awesome-support'));
?>
	</form>
	<?php 
if ('allow' === $registration) {
    ?>

		<form class="wpas-form" id="wpas_form_registration" method="post" action="<?php 
    echo get_permalink($post->ID);
    ?>
">
			<h3><?php 
    _e('Register', 'awesome-support');
    ?>
</h3>
<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>