bbp_format_revision_reason( string $reason = '' )

Formats the reason for editing the topic/reply.


Description Description

Does these things:

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

Parameters Parameters

$reason

(Optional) User submitted reason for editing.

Default value: ''


Top ↑

Return Return

(string) Status of topic


Top ↑

Source Source

File: includes/common/formatting.php

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

	// Bail if reason is empty
	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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.