original_string: protected static function export_post_data(int $userid, \context $context, $postarea, $post) {
          // Store related metadata.
          static::export_read_data($userid, $context, $postarea, $post);
  
          $postdata = (object) [
              'subject' => format_string($post->subject, true),
              'created' => transform::datetime($post->created),
              'modified' => transform::datetime($post->modified),
              'author_was_you' => transform::yesno($post->userid == $userid),
          ];
  
          if (!empty($post->privatereplyto)) {
              $postdata->privatereply = transform::yesno(true);
          }
  
          $postdata->message = writer::with_context($context)
              ->rewrite_pluginfile_urls($postarea, 'mod_forum', 'post', $post->id, $post->message);
  
          $postdata->message = format_text($postdata->message, $post->messageformat, (object) [
              'para'    => false,
              'trusted' => $post->messagetrust,
              'context' => $context,
          ]);
  
          writer::with_context($context)
              // Store the post.
              ->export_data($postarea, $postdata)
  
              // Store the associated files.
              ->export_area_files($postarea, 'mod_forum', 'post', $post->id);
  
          if ($post->userid == $userid) {
              // Store all ratings against this post as the post belongs to the user. All ratings on it are ratings of their content.
              \core_rating\privacy\provider::export_area_ratings($userid, $context, $postarea, 'mod_forum', 'post', $post->id, false);
  
              // Store all tags against this post as the tag belongs to the user.
              \core_tag\privacy\provider::export_item_tags($userid, $context, $postarea, 'mod_forum', 'forum_posts', $post->id);
  
              // Export all user data stored for this post from the plagiarism API.
              $coursecontext = $context->get_course_context();
              \core_plagiarism\privacy\provider::export_plagiarism_user_data($userid, $context, $postarea, [
                      'cmid' => $context->instanceid,
                      'course' => $coursecontext->instanceid,
                      'forum' => $post->forumid,
                      'discussionid' => $post->discussion,
                      'postid' => $post->id,
                  ]);
          }
  
          // Check for any ratings that the user has made on this post.
          \core_rating\privacy\provider::export_area_ratings($userid,
                  $context,
                  $postarea,
                  'mod_forum',
                  'post',
                  $post->id,
                  $userid,
                  true
              );
      }
code: protected static function export_post_data(int $userid, \context $context, $postarea, $post) {
          // Store related metadata.
          static::export_read_data($userid, $context, $postarea, $post);
  
          $postdata = (object) [
              'subject' => format_string($post->subject, true),
              'created' => transform::datetime($post->created),
              'modified' => transform::datetime($post->modified),
              'author_was_you' => transform::yesno($post->userid == $userid),
          ];
  
          if (!empty($post->privatereplyto)) {
              $postdata->privatereply = transform::yesno(true);
          }
  
          $postdata->message = writer::with_context($context)
              ->rewrite_pluginfile_urls($postarea, 'mod_forum', 'post', $post->id, $post->message);
  
          $postdata->message = format_text($postdata->message, $post->messageformat, (object) [
              'para'    => false,
              'trusted' => $post->messagetrust,
              'context' => $context,
          ]);
  
          writer::with_context($context)
              // Store the post.
              ->export_data($postarea, $postdata)
  
              // Store the associated files.
              ->export_area_files($postarea, 'mod_forum', 'post', $post->id);
  
          if ($post->userid == $userid) {
              // Store all ratings against this post as the post belongs to the user. All ratings on it are ratings of their content.
              \core_rating\privacy\provider::export_area_ratings($userid, $context, $postarea, 'mod_forum', 'post', $post->id, false);
  
              // Store all tags against this post as the tag belongs to the user.
              \core_tag\privacy\provider::export_item_tags($userid, $context, $postarea, 'mod_forum', 'forum_posts', $post->id);
  
              // Export all user data stored for this post from the plagiarism API.
              $coursecontext = $context->get_course_context();
              \core_plagiarism\privacy\provider::export_plagiarism_user_data($userid, $context, $postarea, [
                      'cmid' => $context->instanceid,
                      'course' => $coursecontext->instanceid,
                      'forum' => $post->forumid,
                      'discussionid' => $post->discussion,
                      'postid' => $post->id,
                  ]);
          }
  
          // Check for any ratings that the user has made on this post.
          \core_rating\privacy\provider::export_area_ratings($userid,
                  $context,
                  $postarea,
                  'mod_forum',
                  'post',
                  $post->id,
                  $userid,
                  true
              );
      }
code_tokens: protected static function export_post_data ( int $ userid , \ context $ context , $ postarea , $ post ) { // Store related metadata. static :: export_read_data ( $ userid , $ context , $ postarea , $ post ) ; $ postdata = ( object ) [ 'subject' => format_string ( $ post -> subject , true ) , 'created' => transform :: datetime ( $ post -> created ) , 'modified' => transform :: datetime ( $ post -> modified ) , 'author_was_you' => transform :: yesno ( $ post -> userid == $ userid ) , ] ; if ( ! empty ( $ post -> privatereplyto ) ) { $ postdata -> privatereply = transform :: yesno ( true ) ; } $ postdata -> message = writer :: with_context ( $ context ) -> rewrite_pluginfile_urls ( $ postarea , 'mod_forum' , 'post' , $ post -> id , $ post -> message ) ; $ postdata -> message = format_text ( $ postdata -> message , $ post -> messageformat , ( object ) [ 'para' => false , 'trusted' => $ post -> messagetrust , 'context' => $ context , ] ) ; writer :: with_context ( $ context ) // Store the post. -> export_data ( $ postarea , $ postdata ) // Store the associated files. -> export_area_files ( $ postarea , 'mod_forum' , 'post' , $ post -> id ) ; if ( $ post -> userid == $ userid ) { // Store all ratings against this post as the post belongs to the user. All ratings on it are ratings of their content. \ core_rating \ privacy \ provider :: export_area_ratings ( $ userid , $ context , $ postarea , 'mod_forum' , 'post' , $ post -> id , false ) ; // Store all tags against this post as the tag belongs to the user. \ core_tag \ privacy \ provider :: export_item_tags ( $ userid , $ context , $ postarea , 'mod_forum' , 'forum_posts' , $ post -> id ) ; // Export all user data stored for this post from the plagiarism API. $ coursecontext = $ context -> get_course_context ( ) ; \ core_plagiarism \ privacy \ provider :: export_plagiarism_user_data ( $ userid , $ context , $ postarea , [ 'cmid' => $ context -> instanceid , 'course' => $ coursecontext -> instanceid , 'forum' => $ post -> forumid , 'discussionid' => $ post -> discussion , 'postid' => $ post -> id , ] ) ; } // Check for any ratings that the user has made on this post. \ core_rating \ privacy \ provider :: export_area_ratings ( $ userid , $ context , $ postarea , 'mod_forum' , 'post' , $ post -> id , $ userid , true ) ; }
docstring: Export all data in the post.
  
  @param   int         $userid The userid of the user whose data is to be exported.
  @param   \context    $context The instance of the forum context.
  @param   array       $postarea The subcontext of the parent.
  @param   \stdClass   $post The post structure and all of its children
docstring_tokens: Export all data in the post .