• Resolved Ka?lig – SHEBAM!

    (@kaeligshebam)


    Hello
    Can you explain me my error message do not display please

    add_filter( 'wpas_before_submit_new_ticket_checks', 'wpas_limit_concurrently_open_tickets' );
    /**
     * Limit the Number of Concurrent Open Tickets
     * 
     * @param bool|WP_Error $go Submission status
     *
     * @return bool|WP_Error
     */
    function wpas_limit_concurrently_open_tickets( $go ) {
        var_dump( $go );
        $open_tickets = wpas_get_user_tickets( $user_id, 'open' );
        $close_tickets = wpas_get_user_tickets( $user_id, 'closed' );
        $limit     = 7; // -+
        $count   = count( $open_tickets ) + count( $close_tickets);
        if ( $count >= $limit ) {
            // Make sure $go is not already errored
            if ( ! is_wp_error( $go ) ) {
                $go = new WP_Error();
            }
            // Add a custom error message
            $go->add( 'too_many_open_tickets', sprintf( 'Vous avez %1$d tickets maximum et vous les avez tous utilisés !', $limit, $count ) );
        }
        return $go;
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Limit Number user ticket’ is closed to new replies.