Lack of interest Send user notification about new warning instead conversation

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

grisha2217

Active member
I think, xenforo should send notification (Alerts tab in xf2) to user about new warning. Why conversation is using to tell about gotten warning? Pressing on Alerts tab is is easier, than click and load a conversation.

Alert text maybe be like:
You got 2 warning points for "offensive language". When i click on alert, the system will redirect me on warned post. Sorry for my english.

Also i attach my mini solution to do it.
Commented lines - old (current) code.

PHP:
$conversationInput = $this->_input->filter(array(
                'conversation_title' => XenForo_Input::STRING,
                'conversation_message' => XenForo_Input::STRING,
                'conversation_locked' => XenForo_Input::UINT,
                'open_invite' => XenForo_Input::UINT,
            ));


            /*
            $conversationError = false;

            $sendConversation = ($conversationInput['conversation_title'] || $conversationInput['conversation_message']);
            if ($sendConversation)
            {
                if (!$conversationInput['conversation_title'])
                {
                    $conversationError = new XenForo_Phrase('please_enter_valid_title_to_start_conversation');
                }

                if (!$conversationInput['conversation_message'])
                {
                    $conversationError = new XenForo_Phrase('please_enter_valid_message_to_start_conversation');
                }
            }

            if (!$conversationError)
            {
                $dw->save();
            } else
            {
                return $this->responseError($conversationError);
            }

            if ($sendConversation)
            {
                $visitor = XenForo_Visitor::getInstance();

                $conversationInput['conversation_message'] = XenForo_Helper_String::autoLinkBbCode($conversationInput['conversation_message']);

                $conversationDw = XenForo_DataWriter::create('XenForo_DataWriter_ConversationMaster', XenForo_DataWriter::ERROR_SILENT);
                $conversationDw->setExtraData(XenForo_DataWriter_ConversationMaster::DATA_ACTION_USER, $visitor->toArray());
                $conversationDw->setExtraData(XenForo_DataWriter_ConversationMaster::DATA_MESSAGE, $conversationInput['conversation_message']);
                $conversationDw->bulkSet(array(
                    'user_id' => $visitor['user_id'],
                    'username' => $visitor['username'],
                    'title' => $conversationInput['conversation_title'],
                    'open_invite' => $conversationInput['open_invite'],
                    'conversation_open' => ($conversationInput['conversation_locked'] ? 0 : 1),
                ));
                $conversationDw->addRecipientUserIds(array($user['user_id']));

                $messageDw = $conversationDw->getFirstMessageDw();
                $messageDw->set('message', $conversationInput['conversation_message']);
                $conversationDw->save();

                $this->getModelFromCache('XenForo_Model_Conversation')->markConversationAsRead(
                    $conversationDw->get('conversation_id'), XenForo_Visitor::getUserId(), XenForo_Application::$time
                );
            }
            */



            $contentUrl = $warningHandler->getContentUrl($content);
            $redirect = $this->getDynamicRedirectIfNot(
                $this->_buildLink('members/warn', $user),
                $contentUrl
            );


            // Send alert
            $dw->save();
            $alert = array(
                'from_user' => $visitor['user_id'],
                'link_url' => $contentUrl,
                'link_title' => $contentTitle,
                'alert_body' => $conversationInput['conversation_title'],
                'user_id' => $visitor['user_id']
            );
            $data = array(
                'userIds' => [$user['user_id']], // to user id
                'alert' => $alert
            );
            XenForo_Deferred_Abstract::create('UserAlert')->execute(array(), $data, 10, $null);
 
Upvote 3
Top