BBP_Topics_Admin::updated_messages( array $messages )

Custom user feedback messages for topic post type

Description

Parameters

$messages

(Required)

Return

(array)

Source

File: bp-forums/admin/topics.php

	public function updated_messages( $messages ) {
		global $post_ID;

		if ( $this->bail() ) return $messages;

		// URL for the current topic
		$topic_url = bbp_get_topic_permalink( $post_ID );

		// Current topic's post_date
		$post_date = bbp_get_global_post_field( 'post_date', 'raw' );

		// Messages array
		$messages[$this->post_type] = array(
			0 =>  '', // Left empty on purpose

			// Updated
			1 =>  sprintf( __( 'Discussion updated. <a href="%s">View discussion</a>', 'buddyboss' ), $topic_url ),

			// Custom field updated
			2 => __( 'Custom field updated.', 'buddyboss' ),

			// Custom field deleted
			3 => __( 'Custom field deleted.', 'buddyboss' ),

			// Discussion updated
			4 => __( 'Discussion updated.', 'buddyboss' ),

			// Restored from revision
			// translators: %s: date and time of the revision
			5 => isset( $_GET['revision'] )
					? sprintf( __( 'Discussion restored to revision from %s', 'buddyboss' ), wp_post_revision_title( (int) $_GET['revision'], false ) )
					: false,

			// Discussion created
			6 => sprintf( __( 'Discussion created. <a href="%s">View discussion</a>', 'buddyboss' ), $topic_url ),

			// Discussion saved
			7 => __( 'Discussion saved.', 'buddyboss' ),

			// Discussion submitted
			8 => sprintf( __( 'Discussion submitted. <a target="_blank" href="%s">Preview discussion</a>', 'buddyboss' ), esc_url( add_query_arg( 'preview', 'true', $topic_url ) ) ),

			// Discussion scheduled
			9 => sprintf( __( 'Discussion scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview discussion</a>', 'buddyboss' ),
					// translators: Publish box date format, see http://php.net/date
					date_i18n( __( 'M j, Y @ G:i', 'buddyboss' ),
					strtotime( $post_date ) ),
					$topic_url ),

			// Discussion draft updated
			10 => sprintf( __( 'Discussion draft updated. <a target="_blank" href="%s">Preview discussion</a>', 'buddyboss' ), esc_url( add_query_arg( 'preview', 'true', $topic_url ) ) ),
		);

		return $messages;
	}

Changelog

Changelog
Version Description
bbPress (r3080) 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.