| @@ 634-650 (lines=17) @@ | ||
| 631 | */ |
|
| 632 | public function get_status() { |
|
| 633 | ||
| 634 | switch ( $this->get_post_data()->post_status ) { |
|
| 635 | ||
| 636 | case 'publish': |
|
| 637 | $status = 'active'; |
|
| 638 | break; |
|
| 639 | ||
| 640 | case 'draft': |
|
| 641 | $status = 'paused'; |
|
| 642 | break; |
|
| 643 | ||
| 644 | case 'pending': |
|
| 645 | $status = 'disabled'; |
|
| 646 | break; |
|
| 647 | ||
| 648 | default: |
|
| 649 | $status = 'paused'; |
|
| 650 | } |
|
| 651 | ||
| 652 | return apply_filters( 'woocommerce_webhook_status', $status, $this->id ); |
|
| 653 | } |
|
| @@ 676-693 (lines=18) @@ | ||
| 673 | public function update_status( $status ) { |
|
| 674 | global $wpdb; |
|
| 675 | ||
| 676 | switch ( $status ) { |
|
| 677 | ||
| 678 | case 'active' : |
|
| 679 | $post_status = 'publish'; |
|
| 680 | break; |
|
| 681 | ||
| 682 | case 'paused' : |
|
| 683 | $post_status = 'draft'; |
|
| 684 | break; |
|
| 685 | ||
| 686 | case 'disabled' : |
|
| 687 | $post_status = 'pending'; |
|
| 688 | break; |
|
| 689 | ||
| 690 | default : |
|
| 691 | $post_status = 'draft'; |
|
| 692 | break; |
|
| 693 | } |
|
| 694 | ||
| 695 | $wpdb->update( $wpdb->posts, array( 'post_status' => $post_status ), array( 'ID' => $this->id ) ); |
|
| 696 | clean_post_cache( $this->id ); |
|