Last active
September 30, 2016 01:48
-
-
Save kakoma/0ff4a2d52998854ae00f8494206205cf to your computer and use it in GitHub Desktop.
Make KSD ticket public
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'ksd_after_ticket_info_metabox','after_ticket_info_metabox' ); | |
function after_ticket_info_metabox( $post ){ | |
ob_start(); ?> | |
<div style="" class="misc-pub-section misc-pub-public"> | |
<span id="toggle-public"> | |
<b>Make Public?</b> | |
<input type="hidden" name="_ksd_tkt_info_public" value="no" /> | |
<input name="_ksd_tkt_info_public" type="checkbox" <?php checked ( get_post_meta( $post->ID, '_ksd_tkt_info_public', true ), "yes") ?> value="yes" /> | |
</span> | |
</div> | |
<?php | |
echo ob_get_clean(); | |
} | |
add_filter( 'ksd_ticket_info_keys','alter_ksd_ticket_keys' ); | |
function alter_ksd_ticket_keys( $meta_key_array ){ | |
$meta_key_array['_ksd_tkt_info_public'] = 'no'; | |
return $meta_key_array; | |
} | |
add_filter( 'ksd_my_tickets_array','alter_my_ticket_array' ) ; | |
function alter_my_ticket_array( $my_tickets ){ | |
$args = array( | |
'meta_key' => '_ksd_tkt_info_public', | |
'meta_value' => 'yes', | |
'post_type' => 'ksd_ticket', | |
'post_status' => array('new', 'open', 'pending', 'resolved'), | |
); | |
$public_tickets = get_posts( $args ); | |
return array_merge( $my_tickets, $public_tickets ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment