bp_core_setup_message

Set up the display of the 'template_notices' feedback message.

Description

bp_core_setup_message(); 

Checks whether there is a feedback message in the WP cookie and, if so, adds a template_notices action so that the message can be parsed into the template and displayed to the user.

After the message is displayed, it removes the message vars from the cookie so that the message is not shown to the user multiple times.


Usage

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

Defined (1)

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

/bp-core/bp-core-functions.php  
  1. function bp_core_setup_message() { 
  2.  
  3. // Get BuddyPress. 
  4. $bp =buddypress); 
  5.  
  6. if ( empty( $bp->template_message ) && isset( $_COOKIE['bp-message'] ) ) { 
  7. $bp->template_message = stripslashes( $_COOKIE['bp-message'] ); 
  8.  
  9. if ( empty( $bp->template_message_type ) && isset( $_COOKIE['bp-message-type'] ) ) { 
  10. $bp->template_message_type = stripslashes( $_COOKIE['bp-message-type'] ); 
  11.  
  12.  
  13. if ( isset( $_COOKIE['bp-message'] ) ) { 
  14. @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 
  15.  
  16. if ( isset( $_COOKIE['bp-message-type'] ) ) { 
  17. @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );