bp_core_admin_notice_dismiss_callback

Catch and process an admin notice dismissal.

Description

bp_core_admin_notice_dismiss_callback(); 

Usage

  1. if ( !function_exists( 'bp_core_admin_notice_dismiss_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_admin_notice_dismiss_callback(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-core/admin/bp-core-admin-functions.php  
  1. function bp_core_admin_notice_dismiss_callback() { 
  2. if ( ! current_user_can( 'install_plugins' ) ) { 
  3. wp_send_json_error(); 
  4.  
  5. if ( empty( $_POST['nonce'] ) || empty( $_POST['notice_id'] ) ) { 
  6. wp_send_json_error(); 
  7.  
  8. $notice_id = wp_unslash( $_POST['notice_id'] ); 
  9.  
  10. if ( ! wp_verify_nonce( $_POST['nonce'], 'bp-dismissible-notice-' . $notice_id ) ) { 
  11. wp_send_json_error(); 
  12.  
  13. bp_update_option( "bp-dismissed-notice-$notice_id", 1 ); 
  14.  
  15. wp_send_json_success();