bbp_show_topic_lock_alert()

Should the topic-lock alert appear?


Description Description


Return Return

(bool)


Top ↑

Source Source

File: includes/topics/template.php

function bbp_show_topic_lock_alert() {

	// Default to not showing the alert
	$retval = false;

	// Get the current topic ID
	$topic_id = bbp_get_topic_id();

	// Only show on single topic pages
	if ( bbp_is_topic_edit() || bbp_is_single_topic() ) {

		// Only show to moderators
		if ( current_user_can( 'moderate', $topic_id ) ) {

			// Locked?
			$user_id = bbp_check_post_lock( $topic_id );

			// Only show if not locked by the current user
			if ( ! empty( $user_id ) && ( bbp_get_current_user_id() !== $user_id ) ) {
				$retval = true;
			}
		}
	}

	// Filter & return
	return (bool) apply_filters( 'bbp_show_topic_lock_alert', $retval, $topic_id );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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