bp_messages_enforce_current_user( array|string $args = array() )
Enforce limitations on viewing private message contents
Description
See also
- bp_has_message_threads(): for description of parameters
Parameters
- $args
-
(Optional) See bp_has_message_threads().
Default value: array()
Return
(array|string)
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; }
Changelog
Version | Description |
---|---|
BuddyPress 2.3.2 | 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.