Changeset 2747 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/payment-requests-dashboard.php
- Timestamp:
- 03/14/2016 06:17:18 PM (10 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
r2694 r2747 20 20 add_action( 'init', array( __CLASS__, 'upgrade' ) ); 21 21 add_action( 'init', array( __CLASS__, 'process_import_request' ) ); 22 23 // Dashboard actions.24 add_action( 'init', array( __CLASS__, 'process_action_approve' ) );25 add_action( 'init', array( __CLASS__, 'process_action_set_pending_payment' ) );26 22 27 23 // Diff-based updates to the index. … … 245 241 <h1>Vendor Payments</h1> 246 242 247 <?php do_action( 'admin_notices' ); ?>248 243 <?php settings_errors(); ?> 249 244 … … 284 279 285 280 <?php 286 }287 288 /**289 * Process Approve button in network admin290 */291 public static function process_action_approve() {292 if ( ! current_user_can( 'manage_network' ) )293 return;294 295 if ( empty( $_GET['wcb-approve'] ) || empty( $_GET['_wpnonce'] ) )296 return;297 298 list( $blog_id, $post_id ) = explode( '-', $_GET['wcb-approve'] );299 300 if ( ! wp_verify_nonce( $_GET['_wpnonce'], sprintf( 'wcb-approve-%d-%d', $blog_id, $post_id ) ) ) {301 add_action( 'admin_notices', function() {302 ?><div class="notice notice-error is-dismissible">303 <p><?php _e( 'Error! Could not verify nonce.', 'wordcamporg' ); ?></p>304 </div><?php305 });306 return;307 }308 309 switch_to_blog( $blog_id );310 $post = get_post( $post_id );311 if ( $post->post_type == 'wcp_payment_request' ) {312 $post->post_status = 'wcb-approved';313 wp_insert_post( $post );314 315 WordCamp_Budgets::log( $post->ID, get_current_user_id(), 'Request approved via Network Admin', array(316 'action' => 'approved',317 ) );318 319 add_action( 'admin_notices', function() {320 ?><div class="notice notice-success is-dismissible">321 <p><?php _e( 'Success! Request has been marked as approved.', 'wordcamporg' ); ?></p>322 </div><?php323 });324 }325 restore_current_blog();326 }327 328 /**329 * Process "Set as Pending Payment" dashboard action.330 */331 public static function process_action_set_pending_payment() {332 if ( ! current_user_can( 'manage_network' ) )333 return;334 335 if ( empty( $_GET['wcb-set-pending-payment'] ) || empty( $_GET['_wpnonce'] ) )336 return;337 338 list( $blog_id, $post_id ) = explode( '-', $_GET['wcb-set-pending-payment'] );339 340 if ( ! wp_verify_nonce( $_GET['_wpnonce'], sprintf( 'wcb-set-pending-payment-%d-%d', $blog_id, $post_id ) ) ) {341 add_action( 'admin_notices', function() {342 ?><div class="notice notice-error is-dismissible">343 <p><?php _e( 'Error! Could not verify nonce.', 'wordcamporg' ); ?></p>344 </div><?php345 });346 return;347 }348 349 switch_to_blog( $blog_id );350 $post = get_post( $post_id );351 if ( $post->post_type == 'wcp_payment_request' ) {352 $post->post_status = 'wcb-pending-payment';353 wp_insert_post( $post );354 355 WordCamp_Budgets::log( $post->ID, get_current_user_id(), 'Request set as Pending Payment via Network Admin', array(356 'action' => 'set-pending-payment',357 ) );358 359 add_action( 'admin_notices', function() {360 ?><div class="notice notice-success is-dismissible">361 <p><?php _e( 'Success! Request has been marked as Pending Payment.', 'wordcamporg' ); ?></p>362 </div><?php363 });364 }365 restore_current_blog();366 281 } 367 282
Note: See TracChangeset
for help on using the changeset viewer.