feat(forum): add complete forum workflows
This commit is contained in:
1 parent
a254cbd3e9
commit
ee65fc7fd2
39 files changed
+3425
-4
No files matched your search
@@ -160,6 +160,10 @@ function jio_get_search_type_options(): array {
|
||||
'post' => __('文章', 'jio'),
|
||||
'user' => __('用户', 'jio'),
|
||||
];
|
||||
if (class_exists('\\Jio\\Forum\\Core') && \Jio\Forum\Core::enabled() && jio_get_setting('jio_forum_search_enabled', true)) {
|
||||
$label_map['forum'] = __('帖子', 'jio');
|
||||
$label_map['plate'] = __('版块', 'jio');
|
||||
}
|
||||
|
||||
if (!class_exists('\Jio\Settings\Settings')) {
|
||||
return ['post' => $label_map['post']];
|
||||
@@ -175,6 +179,10 @@ function jio_get_search_type_options(): array {
|
||||
$options[$type] = $label_map[$type];
|
||||
}
|
||||
}
|
||||
if (isset($label_map['forum'])) {
|
||||
$options['forum'] = $label_map['forum'];
|
||||
$options['plate'] = $label_map['plate'];
|
||||
}
|
||||
|
||||
if (empty($options)) {
|
||||
$options['post'] = $label_map['post'];
|
||||
|
||||
@@ -417,8 +417,10 @@ function jio_notify_post_author_of_comment(WP_Comment $comment): void {
|
||||
if ($owner_id <= 0 || $owner_id === (int) $comment->user_id) return;
|
||||
jio_add_user_notification($owner_id, [
|
||||
'type' => 'comment',
|
||||
'title' => __('文章收到评论', 'jio'),
|
||||
'desc' => sprintf(__('%1$s 评论了你的文章《%2$s》。', 'jio'), get_comment_author($comment), get_the_title($post)),
|
||||
'title' => $post->post_type === \Jio\Forum\Core::POST ? __('帖子收到回复', 'jio') : __('文章收到评论', 'jio'),
|
||||
'desc' => $post->post_type === \Jio\Forum\Core::POST
|
||||
? sprintf(__('%1$s 回复了你的帖子《%2$s》。', 'jio'), get_comment_author($comment), get_the_title($post))
|
||||
: sprintf(__('%1$s 评论了你的文章《%2$s》。', 'jio'), get_comment_author($comment), get_the_title($post)),
|
||||
'url' => get_comment_link($comment),
|
||||
]);
|
||||
update_comment_meta($comment->comment_ID, 'jio_post_comment_notified', 1);
|
||||
|
||||
@@ -43,6 +43,12 @@ $_jio_special_templates = [
|
||||
'title' => '发布文章',
|
||||
'fallback' => '/submit/',
|
||||
],
|
||||
'forums' => [
|
||||
'file' => 'templates/pages/page-forums.php',
|
||||
'slug' => 'forums',
|
||||
'title' => '论坛',
|
||||
'fallback' => '/forums/',
|
||||
],
|
||||
];
|
||||
|
||||
/** @var array 缓存 key=模板文件路径 => value=WP_Post|null */
|
||||
|
||||
Reference in new issue
Block a user