public static function get_message_processor($userid = 0, $name) {
        global $USER, $PAGE, $CFG;

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

        $params = self::validate_parameters(
            self::get_message_processor_parameters(),
            array(
                'userid' => $userid,
                'name' => $name,
            )
        );

        if (empty($params['userid'])) {
            $params['userid'] = $USER->id;
        }

        $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
        core_user::require_active_user($user);
        self::validate_context(context_user::instance($params['userid']));

        $processor = get_message_processor($params['name']);

        $processoroutput = new \core_message\output\processor($processor, $user);
        $renderer = $PAGE->get_renderer('core_message');

        return $processoroutput->export_for_template($renderer);
    }
public static function get_message_processor($userid = 0, $name) {
        global $USER, $PAGE, $CFG;

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

        $params = self::validate_parameters(
            self::get_message_processor_parameters(),
            array(
                'userid' => $userid,
                'name' => $name,
            )
        );

        if (empty($params['userid'])) {
            $params['userid'] = $USER->id;
        }

        $user = core_user::get_user($params['userid'], '*', MUST_EXIST);
        core_user::require_active_user($user);
        self::validate_context(context_user::instance($params['userid']));

        $processor = get_message_processor($params['name']);

        $processoroutput = new \core_message\output\processor($processor, $user);
        $renderer = $PAGE->get_renderer('core_message');

        return $processoroutput->export_for_template($renderer);
    }
public static function get_message_processor ( $ userid = 0 , $ name ) { global $ USER , $ PAGE , $ CFG ; // Check if messaging is enabled. if ( empty ( $ CFG -> messaging ) ) { throw new moodle_exception ( 'disabled' , 'message' ) ; } $ params = self :: validate_parameters ( self :: get_message_processor_parameters ( ) , array ( 'userid' => $ userid , 'name' => $ name , ) ) ; if ( empty ( $ params [ 'userid' ] ) ) { $ params [ 'userid' ] = $ USER -> id ; } $ user = core_user :: get_user ( $ params [ 'userid' ] , '*' , MUST_EXIST ) ; core_user :: require_active_user ( $ user ) ; self :: validate_context ( context_user :: instance ( $ params [ 'userid' ] ) ) ; $ processor = get_message_processor ( $ params [ 'name' ] ) ; $ processoroutput = new \ core_message \ output \ processor ( $ processor , $ user ) ; $ renderer = $ PAGE -> get_renderer ( 'core_message' ) ; return $ processoroutput -> export_for_template ( $ renderer ) ; }
Get a message processor.

@param int $userid
@param string $name the name of the processor
@return external_description
@throws moodle_exception
@since 3.2
Get a message processor .