nanodesigns / nanosupport

Create a fully featured Support Center in your WordPress setup without any third party dependency, completely FREE. Get a built-in Knowledgebase too. The plugin is available on WordPress.org repository:
https://wordpress.org/plugins/nanosupport/
GNU General Public License v2.0
50 stars 13 forks source link

Tickets direct to "Open" instead of "Pending" #93

Closed gjrowe closed 3 years ago

gjrowe commented 4 years ago

Currently all tickets when submitted are unpublished and are "Pending". It would be good if we could opt to have them auto publish and go to "Open" status.

mayeenulislam commented 4 years ago

Good call. A feature would be nice. Duly noted with thanks.

mayeenulislam commented 3 years ago

Just today we figured out that it can be possible with a filter hook already available with NanoSupport v0.6.0. You can put the following code in your theme's functions.php or in a separate plugin:

/**
 * Tweak NanoSupport Tickets to be 'open' by default.
 * @param  array $data Array of Ticket data.
 * @return array       Array of modified ticket data.
 */
function my_tweak_ns_ticket_status_to_private( $data ) {
    if ( ! ns_is_user( 'manager' ) ) {
        $data['post_status'] = 'private';
    }

    return $data;
}

add_filter( 'ns_ticket_data', 'my_tweak_ns_ticket_status_to_private' );

All the tickets submitted by the 'non-manager' would get the 'private' status instead of 'pending'. 😃