public static function data_for_messagearea_conversations($userid, $limitfrom = 0, $limitnum = 0) {
        global $CFG, $PAGE, $USER;

        // Check if messaging is enabled.
        if (empty($CFG->messaging)) {
            throw new moodle_exception('disabled', 'message');
        }

        $systemcontext = context_system::instance();

        $params = array(
            'userid' => $userid,
            'limitfrom' => $limitfrom,
            'limitnum' => $limitnum
        );
        $params = self::validate_parameters(self::data_for_messagearea_conversations_parameters(), $params);
        self::validate_context($systemcontext);

        if (($USER->id != $params['userid']) && !has_capability('moodle/site:readallmessages', $systemcontext)) {
            throw new moodle_exception('You do not have permission to perform this action.');
        }

        $conversations = \core_message\api::get_conversations($params['userid'], $params['limitfrom'], $params['limitnum']);

        // Format the conversations in the legacy style, as the get_conversations method has since been changed.
        $conversations = \core_message\helper::get_conversations_legacy_formatter($conversations);

        $conversations = new \core_message\output\messagearea\contacts(null, $conversations);

        $renderer = $PAGE->get_renderer('core_message');
        return $conversations->export_for_template($renderer);
    }
public static function data_for_messagearea_conversations($userid, $limitfrom = 0, $limitnum = 0) {
        global $CFG, $PAGE, $USER;

        // Check if messaging is enabled.
        if (empty($CFG->messaging)) {
            throw new moodle_exception('disabled', 'message');
        }

        $systemcontext = context_system::instance();

        $params = array(
            'userid' => $userid,
            'limitfrom' => $limitfrom,
            'limitnum' => $limitnum
        );
        $params = self::validate_parameters(self::data_for_messagearea_conversations_parameters(), $params);
        self::validate_context($systemcontext);

        if (($USER->id != $params['userid']) && !has_capability('moodle/site:readallmessages', $systemcontext)) {
            throw new moodle_exception('You do not have permission to perform this action.');
        }

        $conversations = \core_message\api::get_conversations($params['userid'], $params['limitfrom'], $params['limitnum']);

        // Format the conversations in the legacy style, as the get_conversations method has since been changed.
        $conversations = \core_message\helper::get_conversations_legacy_formatter($conversations);

        $conversations = new \core_message\output\messagearea\contacts(null, $conversations);

        $renderer = $PAGE->get_renderer('core_message');
        return $conversations->export_for_template($renderer);
    }
public static function data_for_messagearea_conversations ( $ userid , $ limitfrom = 0 , $ limitnum = 0 ) { global $ CFG , $ PAGE , $ USER ; // Check if messaging is enabled. if ( empty ( $ CFG -> messaging ) ) { throw new moodle_exception ( 'disabled' , 'message' ) ; } $ systemcontext = context_system :: instance ( ) ; $ params = array ( 'userid' => $ userid , 'limitfrom' => $ limitfrom , 'limitnum' => $ limitnum ) ; $ params = self :: validate_parameters ( self :: data_for_messagearea_conversations_parameters ( ) , $ params ) ; self :: validate_context ( $ systemcontext ) ; if ( ( $ USER -> id != $ params [ 'userid' ] ) && ! has_capability ( 'moodle/site:readallmessages' , $ systemcontext ) ) { throw new moodle_exception ( 'You do not have permission to perform this action.' ) ; } $ conversations = \ core_message \ api :: get_conversations ( $ params [ 'userid' ] , $ params [ 'limitfrom' ] , $ params [ 'limitnum' ] ) ; // Format the conversations in the legacy style, as the get_conversations method has since been changed. $ conversations = \ core_message \ helper :: get_conversations_legacy_formatter ( $ conversations ) ; $ conversations = new \ core_message \ output \ messagearea \ contacts ( null , $ conversations ) ; $ renderer = $ PAGE -> get_renderer ( 'core_message' ) ; return $ conversations -> export_for_template ( $ renderer ) ; }
Get messagearea conversations.

NOTE FOR FINAL DEPRECATION:
When removing this method, please also consider removal of get_conversations_legacy_formatter()
from the \core_message\helper class. This helper method was used solely to format the new get_conversations() return data
into the old format used here, and in message/index.php. If we no longer need either of these, then that method can be
removed.

@deprecated since 3.6
@param int $userid The id of the user who we are viewing conversations for
@param int $limitfrom
@param int $limitnum
@return stdClass
@throws moodle_exception
@since 3.2
Get messagearea conversations .