Changeset 2641 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network
- Timestamp:
- 02/26/2016 06:17:34 PM (10 years ago)
- Location:
- sites/trunk/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/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/payment-requests-dashboard.php
r2632 r2641 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' ) );23 22 add_action( 'init', array( __CLASS__, 'process_export_request' ) ); 24 23 add_action( 'init', array( __CLASS__, 'process_import_request' ) ); 24 25 // Dashboard actions. 26 add_action( 'init', array( __CLASS__, 'process_action_approve' ) ); 27 add_action( 'init', array( __CLASS__, 'process_action_set_pending_payment' ) ); 25 28 26 29 // Diff-based updates to the index. … … 303 306 * Process Approve button in network admin 304 307 */ 305 public static function process_a pproval() {306 if ( ! current_user_can( ' network_admin' ) )308 public static function process_action_approve() { 309 if ( ! current_user_can( 'manage_network' ) ) 307 310 return; 308 311 … … 334 337 ?><div class="notice notice-success is-dismissible"> 335 338 <p><?php _e( 'Success! Request has been marked as approved.', 'wordcamporg' ); ?></p> 339 </div><?php 340 }); 341 } 342 restore_current_blog(); 343 } 344 345 /** 346 * Process "Set as Pending Payment" dashboard action. 347 */ 348 public static function process_action_set_pending_payment() { 349 if ( ! current_user_can( 'manage_network' ) ) 350 return; 351 352 if ( empty( $_GET['wcb-set-pending-payment'] ) || empty( $_GET['_wpnonce'] ) ) 353 return; 354 355 list( $blog_id, $post_id ) = explode( '-', $_GET['wcb-set-pending-payment'] ); 356 357 if ( ! wp_verify_nonce( $_GET['_wpnonce'], sprintf( 'wcb-set-pending-payment-%d-%d', $blog_id, $post_id ) ) ) { 358 add_action( 'admin_notices', function() { 359 ?><div class="notice notice-error is-dismissible"> 360 <p><?php _e( 'Error! Could not verify nonce.', 'wordcamporg' ); ?></p> 361 </div><?php 362 }); 363 return; 364 } 365 366 switch_to_blog( $blog_id ); 367 $post = get_post( $post_id ); 368 if ( $post->post_type == 'wcp_payment_request' ) { 369 $post->post_status = 'wcb-pending-payment'; 370 wp_insert_post( $post ); 371 372 WordCamp_Budgets::log( $post->ID, get_current_user_id(), 'Request set as Pending Payment via Network Admin', array( 373 'action' => 'set-pending-payment', 374 ) ); 375 376 add_action( 'admin_notices', function() { 377 ?><div class="notice notice-success is-dismissible"> 378 <p><?php _e( 'Success! Request has been marked as Pending Payment.', 'wordcamporg' ); ?></p> 336 379 </div><?php 337 380 }); -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/payment-requests-list-table.php
r2632 r2641 150 150 151 151 if ( $request->post_status == 'wcb-pending-approval' ) { 152 $a pprove_url = wp_nonce_url( add_query_arg( array(152 $action_url = wp_nonce_url( add_query_arg( array( 153 153 'wcb-approve' => sprintf( '%d-%d', $blog_id, $request->ID ), 154 154 ) ), sprintf( 'wcb-approve-%d-%d', $blog_id, $request->ID ) ); 155 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 ) ); 156 $actions['wcb-approve'] = sprintf( '<a style="color: green;" onclick="return confirm(\'Approve this payment request?\');" href="%s">Approve</a>', esc_url( $action_url ) ); 157 158 } elseif ( $request->post_status == 'wcb-approved' ) { 159 $action_url = wp_nonce_url( add_query_arg( array( 160 'wcb-set-pending-payment' => sprintf( '%d-%d', $blog_id, $request->ID ), 161 ) ), sprintf( 'wcb-set-pending-payment-%d-%d', $blog_id, $request->ID ) ); 162 163 $actions['wcb-set-pending-payment'] = sprintf( '<a style="color: green;" onclick="return confirm(\'Set this request as pending payment?\');" href="%s">Set as Pending Payment</a>', esc_url( $action_url ) ); 157 164 } 158 165
Note: See TracChangeset
for help on using the changeset viewer.