Changeset 2627
- Timestamp:
- 02/26/2016 12:34:20 AM (10 years ago)
- Location:
- sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes
- Files:
-
- 2 edited
-
payment-requests-dashboard.php (modified) (3 diffs)
-
payment-requests-list-table.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/payment-requests-dashboard.php
r2623 r2627 20 20 add_action( 'network_admin_menu', array( __CLASS__, 'network_admin_menu' ) ); 21 21 add_action( 'init', array( __CLASS__, 'upgrade' ) ); 22 add_action( 'init', array( __CLASS__, 'process_approval' ) ); 22 23 add_action( 'init', array( __CLASS__, 'process_export_request' ) ); 23 24 add_action( 'init', array( __CLASS__, 'process_import_request' ) ); … … 256 257 <h1>Vendor Payments</h1> 257 258 259 <?php do_action( 'admin_notices' ); ?> 258 260 <?php settings_errors(); ?> 259 261 … … 296 298 297 299 <?php 300 } 301 302 /** 303 * Process Approve button in network admin 304 */ 305 public static function process_approval() { 306 if ( ! current_user_can( 'network_admin' ) ) 307 return; 308 309 if ( empty( $_GET['wcb-approve'] ) || empty( $_GET['_wpnonce'] ) ) 310 return; 311 312 list( $blog_id, $post_id ) = explode( '-', $_GET['wcb-approve'] ); 313 314 if ( ! wp_verify_nonce( $_GET['_wpnonce'], sprintf( 'wcb-approve-%d-%d', $blog_id, $post_id ) ) ) { 315 add_action( 'admin_notices', function() { 316 ?><div class="notice notice-error is-dismissible"> 317 <p><?php _e( 'Error! Could not verify nonce.', 'wordcamporg' ); ?></p> 318 </div><?php 319 }); 320 return; 321 } 322 323 switch_to_blog( $blog_id ); 324 $post = get_post( $post_id ); 325 if ( $post->post_type == 'wcp_payment_request' ) { 326 $post->post_status = 'wcb-approved'; 327 wp_insert_post( $post ); 328 329 WordCamp_Budgets::log( $post->ID, get_current_user_id(), 'Request approved via Network Admin', array( 330 'action' => 'approved', 331 ) ); 332 333 add_action( 'admin_notices', function() { 334 ?><div class="notice notice-success is-dismissible"> 335 <p><?php _e( 'Success! Request has been marked as approved.', 'wordcamporg' ); ?></p> 336 </div><?php 337 }); 338 } 339 restore_current_blog(); 298 340 } 299 341 -
sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/payment-requests-list-table.php
r2623 r2627 142 142 */ 143 143 public function column_payment( $request ) { 144 $title = empty( $request->post_title ) ? '(no title)' : $request->post_title; 144 $blog_id = get_current_blog_id(); 145 $title = empty( $request->post_title ) ? '(no title)' : $request->post_title; 145 146 $edit_post_link = add_query_arg( array( 'post' => $request->ID, 'action' => 'edit' ), admin_url( 'post.php' ) ); 146 147 $actions = array( 147 148 'view-all' => sprintf( '<a href="%s" target="_blank">View All</a>', esc_url( admin_url( 'edit.php?post_type=wcp_payment_request' ) ) ), 148 149 ); 150 151 if ( $request->post_status == 'wcb-pending-approval' ) { 152 $approve_url = wp_nonce_url( add_query_arg( array( 153 'wcb-approve' => sprintf( '%d-%d', $blog_id, $request->ID ), 154 ) ), sprintf( 'wcb-approve-%d-%d', $blog_id, $request->ID ) ); 155 156 $actions['wcb-approve'] = sprintf( '<a style="color: green;" onclick="return confirm(\'Approve this payment request?\');" href="%s">Approve</a>', esc_url( $approve_url ) ); 157 } 149 158 150 159 return sprintf( '<a href="%s" class="row-title" target="_blank">%s</a>%s',
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)