Changeset 2615 for sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php
- Timestamp:
- 02/25/2016 07:02:13 PM (10 years ago)
- Location:
- sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
includes/payment-request.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
- Property svn:mergeinfo changed (with no actual effect on merging)
-
sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php
r2609 r2615 23 23 24 24 // Saving posts 25 add_filter( 'wp_insert_post_data', array( $this, ' ensure_post_date_gmt_set' ), 10, 2 );25 add_filter( 'wp_insert_post_data', array( $this, 'wp_insert_post_data' ), 10, 2 ); 26 26 add_action( 'save_post', array( $this, 'save_payment' ), 10, 2 ); 27 27 add_filter( 'map_meta_cap', array( $this, 'modify_capabilities' ), 10, 4 ); … … 288 288 } 289 289 290 $submit_text = 'auto-draft' == $post->post_status ? __( 'Submit', 'wordcamporg' ) : __( 'Update', 'wordcamporg' );291 290 $editable_statuses = array( 'auto-draft', 'draft', 'wcb-incomplete' ); 292 $current_user_can_edit_request = in_array( $post->post_status, $editable_statuses ) || current_user_can( 'manage_network' ); 291 $current_user_can_edit_request = false; 292 $submit_text = _x( 'Update', 'payment request', 'wordcamporg' ); 293 294 if ( current_user_can( 'manage_network' ) ) { 295 $current_user_can_edit_request = true; 296 } elseif ( in_array( $post->post_status, $editable_statuses ) ) { 297 $submit_text = __( 'Submit for Review', 'wordcamporg' ); 298 $current_user_can_edit_request = true; 299 } 293 300 294 301 $date_vendor_paid = get_post_meta( $post->ID, '_camppayments_date_vendor_paid', true ); … … 300 307 301 308 $incomplete_notes = get_post_meta( $post->ID, '_wcp_incomplete_notes', true ); 309 $incomplete_readonly = ! current_user_can( 'manage_network' ) ? 'readonly' : ''; 310 302 311 require_once( dirname( __DIR__ ) . '/views/payment-request/metabox-status.php' ); 303 312 } … … 585 594 586 595 /** 587 * Ensure that new posts have the `post_date_gmt` field populated.588 *589 * Core only handles this for post types that use the `draft` status (see r8636).590 596 * 591 597 * @param array $post_data … … 594 600 * @return array 595 601 */ 596 public function ensure_post_date_gmt_set( $post_data, $post_data_raw ) { 602 public function wp_insert_post_data( $post_data, $post_data_raw ) { 603 if ( $post_data['post_type'] != self::POST_TYPE ) 604 return $post_data; 605 606 // Ensure that new posts have the `post_date_gmt` field populated. 597 607 if ( 'auto-draft' !== $post_data['post_status'] ) { 598 608 if ( '0000-00-00 00:00:00' === $post_data['post_date_gmt'] ) { 599 609 $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] ); 610 } 611 } 612 613 // Save Draft button was clicked. 614 if ( ! empty( $post_data_raw['wcb-save-draft'] ) ) { 615 $post_data['post_status'] = 'draft'; 616 } 617 618 // Submit for Review button was clicked. 619 if ( ! current_user_can( 'manage_network' ) ) { 620 $editable_statuses = array( 'auto-draft', 'draft', 'wcb-incomplete' ); 621 if ( ! empty( $post_data_raw['wcb-update'] ) && in_array( $post_data['post_status'], $editable_statuses ) ) { 622 $post_data['post_status'] = 'wcb-pending-approval'; 600 623 } 601 624 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)