public static function is_user_blocked($recipientid, $senderid = null) {
        debugging('\core_message\api::is_user_blocked is deprecated and should not be used.',
            DEBUG_DEVELOPER);

        global $USER;

        if (is_null($senderid)) {
            // The message is from the logged in user, unless otherwise specified.
            $senderid = $USER->id;
        }

        $systemcontext = \context_system::instance();
        if (has_capability('moodle/site:readallmessages', $systemcontext, $senderid)) {
            return false;
        }

        if (self::is_blocked($recipientid, $senderid)) {
            return true;
        }

        return false;
    }
public static function is_user_blocked($recipientid, $senderid = null) {
        debugging('\core_message\api::is_user_blocked is deprecated and should not be used.',
            DEBUG_DEVELOPER);

        global $USER;

        if (is_null($senderid)) {
            // The message is from the logged in user, unless otherwise specified.
            $senderid = $USER->id;
        }

        $systemcontext = \context_system::instance();
        if (has_capability('moodle/site:readallmessages', $systemcontext, $senderid)) {
            return false;
        }

        if (self::is_blocked($recipientid, $senderid)) {
            return true;
        }

        return false;
    }
public static function is_user_blocked ( $ recipientid , $ senderid = null ) { debugging ( '\core_message\api::is_user_blocked is deprecated and should not be used.' , DEBUG_DEVELOPER ) ; global $ USER ; if ( is_null ( $ senderid ) ) { // The message is from the logged in user, unless otherwise specified. $ senderid = $ USER -> id ; } $ systemcontext = \ context_system :: instance ( ) ; if ( has_capability ( 'moodle/site:readallmessages' , $ systemcontext , $ senderid ) ) { return false ; } if ( self :: is_blocked ( $ recipientid , $ senderid ) ) { return true ; } return false ; }
Checks if the recipient has specifically blocked the sending user.

Note: This function will always return false if the sender has the
readallmessages capability at the system context level.

@deprecated since 3.6
@param int $recipientid User ID of the recipient.
@param int $senderid User ID of the sender.
@return bool true if $sender is blocked, false otherwise.
Checks if the recipient has specifically blocked the sending user .