accept to delete topics by anonymous user.

This commit is contained in:
2020-12-17 18:57:18 +09:00
parent e4773eb254
commit cde2c85825
2 changed files with 51 additions and 0 deletions

View File

@ -34,6 +34,19 @@
$buttons = array( 'solved', 'sticky', 'private', 'close', 'report', 'delete', 'link' );
}else{
$buttons = array( 'report', 'delete', 'link' );
}
if (!is_user_logged_in()) {
$forumid = (isset($forum['forumid'])) ? $forum['forumid'] : 0;
$topicid = (isset($topic['topicid'])) ? $topic['topicid'] : 0;
$is_topic = (bool) wpfval($post, 'is_first_post');
$diff = current_time( 'timestamp', 1 ) - strtotime($post['created']);
if (WPF()->perm->forum_can(($is_topic ? 'dt' : 'dr' ), $forumid)
&& (WPF()->perm->forum_can( ($is_topic ? 'dot' : 'dor'), $forumid)
|| $diff < WPF()->post->options[($is_topic ? 'dot' : 'dor').'_durr'])) {
$a = ( $is_topic ) ? 'wpftopicdelete' : 'wpfreplydelete';
$b = ( $is_topic ) ? $topicid : $postid;
echo '<span wpf-tooltip="'.esc_attr(wpforo_phrase('Delete', false)).'" id="'.esc_attr($a.$b).'" class="wpf-action wpforo-delete"><i class="fas fa-trash-alt wpfsx"></i><span class="wpf-button-text">'.wpforo_phrase('Delete', false).'</span></span>';
}
}
wpforo_post_buttons( 'icon-text', $buttons, $forum, $topic, $post );
?>