bp_core_setup_message()
Set up the display of the ‘template_notices’ feedback message.
Description
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.
Source
File: bp-core/bp-core-functions.php
function bp_core_setup_message() { // Get BuddyPress. $bp = buddypress(); if ( empty( $bp->template_message ) && isset( $_COOKIE['bp-message'] ) ) { $bp->template_message = stripslashes( $_COOKIE['bp-message'] ); } if ( empty( $bp->template_message_type ) && isset( $_COOKIE['bp-message-type'] ) ) { $bp->template_message_type = stripslashes( $_COOKIE['bp-message-type'] ); } add_action( 'template_notices', 'bp_core_render_message' ); if ( isset( $_COOKIE['bp-message'] ) ) { @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); } if ( isset( $_COOKIE['bp-message-type'] ) ) { @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH, COOKIE_DOMAIN, is_ssl() ); } }
Changelog
Version | Description |
---|---|
BuddyPress 1.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.