bbp_format_revision_reason( $reason = '' )

Formats the reason for editing the topic/reply.

Description

Does these things:

  • Trimming
  • Removing periods from the end of the string
  • Trimming again

Parameters

$topic_id

(Optional) Topic id

Return

(string) Status of topic

Source

File: bp-forums/common/functions.php

function bbp_format_revision_reason( $reason = '' ) {
	$reason = (string) $reason;

	// Format reason for proper display
	if ( empty( $reason ) )
		return $reason;

	// Trimming
	$reason = trim( $reason );

	// We add our own full stop.
	while ( substr( $reason, -1 ) === '.' )
		$reason = substr( $reason, 0, -1 );

	// Trim again
	$reason = trim( $reason );

	return $reason;
}

Changelog

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