bp_messages_enforce_current_user( array|string $args = array() )

Enforce limitations on viewing private message contents


Description Description

See also See also


Top ↑

Parameters Parameters

$args

(array|string) (Optional) See bp_has_message_threads().

Default value: array()


Top ↑

Return Return

(array|string)


Top ↑

Source Source

File: bp-messages/bp-messages-filters.php

function bp_messages_enforce_current_user( $args = array() ) {

	// Non-community moderators can only ever see their own messages.
	if ( is_user_logged_in() && ! bp_current_user_can( 'bp_moderate' ) ) {
		$_user_id = (int) bp_loggedin_user_id();
		if ( $_user_id !== (int) $args['user_id'] ) {
			$args['user_id'] = $_user_id;
		}
	}

	// Return possibly modified $args array.
	return $args;
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.3.2 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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