Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_core_add_message Persists on Next Page


  • Fencer04
    Participant

    @fencer04

    I’m setting a cookie to display a message on the conversation view after sending a PM. The message displays correctly but the message is there when I go to another page in my profile. The second page I visit after sending the message clears the messages. Code below:

    function sbpp04_messaging_some_recipients_error(){
    	if( isset( $_COOKIE[ 'sbpp04-messages-some-blocked' ] ) ){
    		$error_message = __( 'Some recipients blocked your message.', 'buddypress' );
    		bp_core_add_message( $error_message, 'error' );
    		$_COOKIE[ 'sbpp04-messages-some-blocked' ] = false;
    	}
    }
    add_action( 'messages_screen_conversation', 'sbpp04_messaging_some_recipients_error' );
  • You must be logged in to reply to this topic.
Skip to toolbar