Changeset 2641 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/payment-requests-dashboard.php
- Timestamp:
- 02/26/2016 06:17:34 PM (11 years ago)
- File:
-
- 1 edited
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 });
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)