<?php
// 消息台页面
if (!is_user_logged_in()) {
    wp_redirect(home_url());
    exit;
}

get_header();
$type = get_query_var('msg_action') ? get_query_var('msg_action') : 'whisper';
?>

<div class="pix-content home-box home-classic">
    <div class="user-center uk-grid-collapse" uk-grid>
        <div class="uk-width-1-4 user-left">
            <div class="user-left-nav">
                <?php echo msg_center_nav($type); ?>
            </div>
        </div>

        <div class="uk-width-3-4 user-right" uk-height-viewport="expand: true">
            <div class="user-index">
                <?php get_template_part( 'inc/layouts/msg', $type ); ?>
            </div>
        </div>
    </div>
</div>


<?php
get_footer();   
?>

<script type="text/javascript">
  $(document).ready(function(){

    var type = '<?php echo $type;?>';

    if(type == 'like' || type == 'reply'){

    switch (type) {
        case "like":
            action = 'upadte_like_msg_read';
            break;
    
            case "reply":
            action = 'upadte_comment_msg_read';
            break;
    }
        
        $.ajax({
            type: 'POST',
            url: Theme.ajaxurl,
            data: {
                action: action,
                nonce: Theme.msg_nonce,
            },
			beforeSend: function() {
                
            },
            success: function(response) {
                
            },
            error: function() {
               
            }
        });
        			
        };
    }); 

</script>
