Ver Fonte

Add functionality to disable message counting for users in specified forums

Visman há 5 anos atrás
pai
commit
5745524335

+ 9 - 0
app/Models/Pages/Admin/Forums.php

@@ -397,6 +397,7 @@ class Forums extends Admin
                     'parent'               => 'required|integer|in:' . implode(',', $this->listOfIndexes),
                     'sort_by'              => 'required|integer|in:0,1,2',
                     'redirect_url'         => 'string:trim|max:255', //????
+                    'no_sum_mess'          => 'required|integer|in:0,1',
                     'perms.*.read_forum'   => 'checkbox',
                     'perms.*.post_replies' => 'checkbox',
                     'perms.*.post_topics'  => 'checkbox',
@@ -413,6 +414,7 @@ class Forums extends Admin
             $forum->forum_desc   = $v->forum_desc;
             $forum->sort_by      = $v->sort_by;
             $forum->redirect_url = $v->redirect_url;
+            $forum->no_sum_mess  = $v->no_sum_mess;
             if ($v->parent > 0) {
                 $forum->parent_forum_id = $v->parent;
                 $forum->cat_id          = $this->c->forums->get($v->parent)->cat_id;
@@ -534,6 +536,13 @@ class Forums extends Admin
                     'info'      => __('Redirect help'),
                     'disabled'  => $forum->num_topics || $forum->subforums ? true : null,
                 ],
+                'no_sum_mess' => [
+                    'type'    => 'radio',
+                    'value'   => $forum->no_sum_mess,
+                    'values'  => [0 => __('Yes'), 1 => __('No')],
+                    'caption' => __('Count messages label'),
+                    'info'    => __('Count messages help', $this->c->Router->link('AdminUsers'), __('Users')),
+                ],
             ],
         ];
 

+ 1 - 1
app/Models/Pages/Post.php

@@ -257,7 +257,7 @@ class Post extends Page
             ! $merge
             && ! $this->user->isGuest
         ) {
-            if ('1' != $forum->no_sum_mess) {
+            if (0 == $forum->no_sum_mess) {
                 $this->user->num_posts = $this->user->num_posts + 1;
 
                 if (

+ 6 - 0
app/lang/en/admin_forums.po

@@ -125,3 +125,9 @@ msgstr ""
 
 msgid "Forum indent"
 msgstr "◦ ◦ "
+
+msgid "Count messages label"
+msgstr "Count messages for users"
+
+msgid "Count messages help"
+msgstr "If YES, then new messages from users in this forum will increase their counter of messages in the profile. You can recalculate messages from all users in <a href=\"%1$s\">%2$s</a>."

+ 6 - 0
app/lang/ru/admin_forums.po

@@ -125,3 +125,9 @@ msgstr ""
 
 msgid "Forum indent"
 msgstr "◦ ◦ "
+
+msgid "Count messages label"
+msgstr "Считать сообщения для пользователей"
+
+msgid "Count messages help"
+msgstr "Если ДА, то новые сообщения пользователей в этом разделе будут увеличивать их счетчик сообщений в профиле. Пересчитать сообщения всех пользователей можно в <a href=\"%1$s\">%2$s</a>."