浏览代码

Update Profile\View page

Add "Send PM" link to user profile.
Visman 4 年之前
父节点
当前提交
17c6578714
共有 1 个文件被更改,包括 20 次插入0 次删除
  1. 20 0
      app/Models/Pages/Profile/View.php

+ 20 - 0
app/Models/Pages/Profile/View.php

@@ -12,6 +12,7 @@ namespace ForkBB\Models\Pages\Profile;
 
 use ForkBB\Models\Page;
 use ForkBB\Models\Pages\Profile;
+use ForkBB\Models\PM\Cnst;
 use function \ForkBB\__;
 
 class View extends Profile
@@ -143,6 +144,25 @@ class View extends Profile
 
         // контактная информация
         $fields = [];
+        if ($this->rules->sendPM) {
+            $this->c->Csrf->setHashExpiration(3600);
+
+            $pmArgs = [
+                'action' => Cnst::ACTION_SEND,
+                'more1'  => $this->curUser->id,
+            ];
+
+            $fields['pm'] = [
+                'class'   => 'pline',
+                'type'    => 'link',
+                'caption' => 'PM',
+                'value'   => __('Send PM'),
+                'href'    => $this->c->Router->link(
+                    'PMAction',
+                    $pmArgs + ['more2' => $this->c->Csrf->createHash('PMAction', $pmArgs)]
+                ),
+            ];
+        }
         if ($this->rules->viewEmail) {
             if (0 === $this->curUser->email_setting) {
                 $fields['email'] = [