ConversationsHooks::profileController_addProfileTabs_handler PHP Метод

profileController_addProfileTabs_handler() публичный Метод

Add 'Inbox' to profile menu.
С версии: 2.0.0
    public function profileController_addProfileTabs_handler($Sender)
    {
        if (Gdn::session()->isValid()) {
            $Inbox = t('Inbox');
            $InboxHtml = sprite('SpInbox') . ' ' . $Inbox;
            $InboxLink = '/messages/all';
            if (Gdn::session()->UserID != $Sender->User->UserID) {
                // Accomodate admin access
                if (c('Conversations.Moderation.Allow', false) && Gdn::session()->checkPermission('Conversations.Moderation.Manage')) {
                    $CountUnread = $Sender->User->CountUnreadConversations;
                    $InboxLink .= "?userid={$Sender->User->UserID}";
                } else {
                    return;
                }
            } else {
                // Current user
                $CountUnread = Gdn::session()->User->CountUnreadConversations;
            }
            if (is_numeric($CountUnread) && $CountUnread > 0) {
                $InboxHtml .= ' <span class="Aside"><span class="Count">' . $CountUnread . '</span></span>';
            }
            $Sender->addProfileTab($Inbox, $InboxLink, 'Inbox', $InboxHtml);
        }
    }