original_string: public function can_delete_post(stdClass $user, discussion_entity $discussion, post_entity $post) : bool {
          global $CFG;
  
          $forum = $this->get_forum();
  
          if ($forum->get_type() == 'single' && $discussion->is_first_post($post)) {
              // Do not allow deleting of first post in single simple type.
              return false;
          } else {
              $context = $this->get_context();
              $ownpost = $post->is_owned_by_user($user);
              $ineditingtime = $post->get_age() < $CFG->maxeditingtime;
  
              return ($ownpost && $ineditingtime && has_capability('mod/forum:deleteownpost', $context, $user)) ||
                  has_capability('mod/forum:deleteanypost', $context, $user);
          }
      }
code: public function can_delete_post(stdClass $user, discussion_entity $discussion, post_entity $post) : bool {
          global $CFG;
  
          $forum = $this->get_forum();
  
          if ($forum->get_type() == 'single' && $discussion->is_first_post($post)) {
              // Do not allow deleting of first post in single simple type.
              return false;
          } else {
              $context = $this->get_context();
              $ownpost = $post->is_owned_by_user($user);
              $ineditingtime = $post->get_age() < $CFG->maxeditingtime;
  
              return ($ownpost && $ineditingtime && has_capability('mod/forum:deleteownpost', $context, $user)) ||
                  has_capability('mod/forum:deleteanypost', $context, $user);
          }
      }
code_tokens: public function can_delete_post ( stdClass $ user , discussion_entity $ discussion , post_entity $ post ) : bool { global $ CFG ; $ forum = $ this -> get_forum ( ) ; if ( $ forum -> get_type ( ) == 'single' && $ discussion -> is_first_post ( $ post ) ) { // Do not allow deleting of first post in single simple type. return false ; } else { $ context = $ this -> get_context ( ) ; $ ownpost = $ post -> is_owned_by_user ( $ user ) ; $ ineditingtime = $ post -> get_age ( ) < $ CFG -> maxeditingtime ; return ( $ ownpost && $ ineditingtime && has_capability ( 'mod/forum:deleteownpost' , $ context , $ user ) ) || has_capability ( 'mod/forum:deleteanypost' , $ context , $ user ) ; } }
docstring: Can the user delete the post in this discussion?
  
  @param stdClass $user The user to check
  @param discussion_entity $discussion The discussion to check
  @param post_entity $post The post the user wants to delete
  @return bool
docstring_tokens: Can the user delete the post in this discussion?