DaveL
Well-known member
Step 12 - Creating the Controller
Here is the final code, below explained:
PHP:/** * Action to send a note to the specified user. */ public function actionSendNote() { //Make sure we are using a method form POST not GET $this->_assertPostOnly(); //Lets get the ID of the user who is given the note $visitor = XenForo_Visitor::getInstance()->toArray(); //The user ID who has received the note $userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT); //Get the message content $note_message = $this->_input->filterSingle('note_message', XenForo_Input::STRING); //The date of the note given $note_date = XenForo_Application::$time; //Instance the DataWriter $dw = XenForo_DataWriter::create('newProfileTabs_DataWriter_Notes'); $dw->set('given_user_id', $visitor['user_id']); $dw->set('received_user_id', $userId); $dw->set('note_message', $note_message); $dw->set('note_date', $note_date); $dw->save(); $note = array('user' => $visitor, 'note_message' => $note_message, 'note_date' => $note_date); $viewParams = array( 'note' => $note ); return $this->responseView('XenForo_ViewPublic_Base', 'newProfileTab_ourTab_newnote', $viewParams); }
Explaining:
Sorry folks, getting a bit lost here. Im guessing theres supposed to be more in the members.php file? However in the guide it says above is the final code....