Moderators Parkho Posted October 3, 2012 Moderators Report Posted October 3, 2012 okay, remove the following and place it at the end right before the </body> and after ?>. Now it sends only one email to you when you hit it. <input type="button" onclick="<?php echo Util::SendEmail($email, $sub, $message);?>" value="Send Email"> Quote
Moderators Parkho Posted October 3, 2012 Moderators Report Posted October 3, 2012 okay man, I just found a very simple way that you wouldn't even believe it copy the following, go to admin/modules/PIREPAdmin/PIREPAdmin.php and find this function approve_pirep_post() and place it at the end before the bracket : It's tested. $this->set('firstname', $pirep_details->firstname); $this->set('lastname', $pirep_details->lastname); $this->set('pirepid', $pirepid); $message = Template::GetTemplate('email_pirep_accep.tpl', true); Util::SendEmail($pirep_details->email, 'Comment Added', $message); How easy was that!!!!??? Quote
Virtualei Posted October 3, 2012 Author Report Posted October 3, 2012 Sorry mate not working have I put it in the correct place if (!PIREPData::updateFlightReport($this->post->pirepid, $data)) { $this->set('message', 'There was an error editing your PIREP'); $this->render('core_error.tpl'); return false; } PIREPData::SaveFields($this->post->pirepid, $_POST); //Accept or reject? $this->post->id = $this->post->pirepid; $submit = strtolower($this->post->submit_pirep); // Add a comment if (trim($this->post->comment) != '' && $submit != 'reject pirep') { PIREPData::AddComment($this->post->pirepid, Auth::$userinfo->pilotid, $this->post->comment); } if ($submit == 'accept pirep') { $this->approve_pirep_post(); $this->set('firstname', $pirep_details->firstname); $this->set('lastname', $pirep_details->lastname); $this->set('pirepid', $pirepid); $message = Template::GetTemplate('email_pirep_accep.tpl', true); Util::SendEmail($pirep_details->email, 'Comment Added', $message); } elseif ($submit == 'reject pirep') { $this->reject_pirep_post(); } StatsData::UpdateTotalHours(); # Refresh the PIREP # $pirepInfo = PIREPData::getReportDetails($this->post_action->pirepid); PilotData::updatePilotStats($pirepInfo->pilotid); LogData::addLog(Auth::$userinfo->pilotid, 'Edited PIREP #' . $this->post->id); return true; } } Quote
Moderators Parkho Posted October 3, 2012 Moderators Report Posted October 3, 2012 Nope. Here like this: protected function approve_pirep_post() { $pirepid = $this->post->id; if($pirepid == '') return; $pirep_details = PIREPData::GetReportDetails($pirepid); # See if it's already been accepted if(intval($pirep_details->accepted) == PIREP_ACCEPTED) return; # Update pilot stats SchedulesData::IncrementFlownCount($pirep_details->code, $pirep_details->flightnum); PIREPData::ChangePIREPStatus($pirepid, PIREP_ACCEPTED); // 1 is accepted PilotData::UpdateFlightData($pirep_details->pilotid, $pirep_details->flighttime, 1); PilotData::UpdatePilotPay($pirep_details->pilotid, $pirep_details->flighttime); RanksData::CalculateUpdatePilotRank($pirep_details->pilotid); PilotData::GenerateSignature($pirep_details->pilotid); StatsData::UpdateTotalHours(); LogData::addLog(Auth::$userinfo->pilotid, 'Approved PIREP #'.$pirepid); # Call the event CodonEvent::Dispatch('pirep_accepted', 'PIREPAdmin', $pirep_details); $this->set('firstname', $pirep_details->firstname); $this->set('lastname', $pirep_details->lastname); $this->set('pirepid', $pirepid); $message = Template::GetTemplate('email_pirep_accep.tpl', true); Util::SendEmail($pirep_details->email, 'PIREP Accepted.', $message); } Quote
Virtualei Posted October 3, 2012 Author Report Posted October 3, 2012 Parkho , How did you find that . After all that work. And yes mate its working yayyyyyyyyyyyy.. I am forever in your debt. Thanks MATE Quote
Moderators Parkho Posted October 3, 2012 Moderators Report Posted October 3, 2012 Anytime man, I'm happy . I just realized that when a pirep gets rejected an email is sent to the pilot, so I went to the reject function, pulled the code, and placed in the accept function and Bingo. Quote
loplo Posted December 21, 2012 Report Posted December 21, 2012 Guys, could you put all the changes needed in one post? It's pretty hard to follow up. Thanks in advance. Quote
Calheiros Posted December 29, 2012 Report Posted December 29, 2012 I have a problem, no email is sent neither the registration nor the admin no pilot receives an e-mail, Parko can help me? Quote
FlightDeckES Posted June 16, 2019 Report Posted June 16, 2019 Hi,could you put all the changes needed in one post? thanks 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.