original_string: public static function data_for_messagearea_get_profile($currentuserid, $otheruserid) {
          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(
              'currentuserid' => $currentuserid,
              'otheruserid' => $otheruserid
          );
          $params = self::validate_parameters(self::data_for_messagearea_get_profile_parameters(), $params);
          self::validate_context($systemcontext);
  
          if (($USER->id != $params['currentuserid']) && !has_capability('moodle/site:readallmessages', $systemcontext)) {
              throw new moodle_exception('You do not have permission to perform this action.');
          }
  
          $profile = \core_message\api::get_profile($params['currentuserid'], $params['otheruserid']);
          $profile = new \core_message\output\messagearea\profile($profile);
  
          $renderer = $PAGE->get_renderer('core_message');
          return $profile->export_for_template($renderer);
      }
code: public static function data_for_messagearea_get_profile($currentuserid, $otheruserid) {
          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(
              'currentuserid' => $currentuserid,
              'otheruserid' => $otheruserid
          );
          $params = self::validate_parameters(self::data_for_messagearea_get_profile_parameters(), $params);
          self::validate_context($systemcontext);
  
          if (($USER->id != $params['currentuserid']) && !has_capability('moodle/site:readallmessages', $systemcontext)) {
              throw new moodle_exception('You do not have permission to perform this action.');
          }
  
          $profile = \core_message\api::get_profile($params['currentuserid'], $params['otheruserid']);
          $profile = new \core_message\output\messagearea\profile($profile);
  
          $renderer = $PAGE->get_renderer('core_message');
          return $profile->export_for_template($renderer);
      }
code_tokens: public static function data_for_messagearea_get_profile ( $ currentuserid , $ otheruserid ) { 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 ( 'currentuserid' => $ currentuserid , 'otheruserid' => $ otheruserid ) ; $ params = self :: validate_parameters ( self :: data_for_messagearea_get_profile_parameters ( ) , $ params ) ; self :: validate_context ( $ systemcontext ) ; if ( ( $ USER -> id != $ params [ 'currentuserid' ] ) && ! has_capability ( 'moodle/site:readallmessages' , $ systemcontext ) ) { throw new moodle_exception ( 'You do not have permission to perform this action.' ) ; } $ profile = \ core_message \ api :: get_profile ( $ params [ 'currentuserid' ] , $ params [ 'otheruserid' ] ) ; $ profile = new \ core_message \ output \ messagearea \ profile ( $ profile ) ; $ renderer = $ PAGE -> get_renderer ( 'core_message' ) ; return $ profile -> export_for_template ( $ renderer ) ; }
docstring: Get the profile information for a contact.
  
  @deprecated since 3.6
  @param int $currentuserid The current user's id
  @param int $otheruserid The id of the user whose profile we are viewing
  @return stdClass
  @throws moodle_exception
  @since 3.2
docstring_tokens: Get the profile information for a contact .