Ariel Posted June 19, 2013 Report Share Posted June 19, 2013 Here's a quick piece of code which will display the user's mailbox on their profile, however with just the date, subject and who from: 1. First, create the file mail_profile.tpl in core/templates/mail and paste the following code: <table width="100%" cellpadding="2"> <?php if(!$mail){ echo '<tr><td align="center" colspan="3">No NOTAMs available</td></tr>'; } else { foreach($mail as $data) { ?> <?php $user = PilotData::GetPilotData($data->who_from);?> <tr> <td width="25%" align="center"><?php echo date(DATE_FORMAT.' H:i', strtotime($data->date)); ?></td> <td><?php echo $user->firstname.' '.$user->lastname;?></td> <td> <?php if ($data->read_state=='0') { ?> <b><a href="http://www.freshjetvirtual.com/index.php/Mail/item/<?php echo $data->thread_id;?>"><?php echo $data->subject; ?></a></b> <?php } else { ?> <a href="http://www.freshjetvirtual.com/index.php/Mail/item/<?php echo $data->thread_id;?>"><?php echo $data->subject; ?></a> <?php } ?> </td> </tr> <?php } } ?> </table> 2. Add the following code to core/modules/Mail/Mail.php : public function GetProfileMail(){ $pid = Auth::$userinfo->pilotid; $this->set('mail', MailData::getallmail($pid)); $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid)); $this->show('mail/mail_profile.tpl'); } 3. In your profile_main.tpl (or wherever else you want): <?php MainController::Run('Mail', 'GetProfileMail', 5);?> The number at the end can be changed to suit how many items you wish to display as per usual. Enjoy everything worked up in till the point of changing the number. It actually displays my whole inbox instead of just 5 items and i have more than 10 in my inbox! Help Please! Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 19, 2013 Author Administrators Report Share Posted June 19, 2013 I am assuming that you are using the latest version of AirMail - The MailData::getallmail function has no limit parameter. public static function getallmail($pid) { if(Auth::$userinfo->pilotid != $pid){ throw new Exception("This mailbox does not belong to you. If you are accessing this via an Administration module, this feature is still in development"); } $query = "SELECT * FROM `".TABLE_PREFIX."airmail` WHERE `who_to`='$pid' AND `deleted_state`='0' AND `receiver_folder`='0' ORDER BY `date` ASC"; $results = DB::get_results($query); $code = DB::errno(); if ($code != 0){ $message = DB::error(); throw new Exception($message, $code); } return $results; } It will have to be updated to include the limit, maybe something like this (using 10 as a default limit); public static function getallmail($pid, $limit = '10') { if(Auth::$userinfo->pilotid != $pid){ throw new Exception("This mailbox does not belong to you. If you are accessing this via an Administration module, this feature is still in development"); } $query = "SELECT * FROM `".TABLE_PREFIX."airmail` WHERE `who_to`='$pid' AND `deleted_state`='0' AND `receiver_folder`='0' ORDER BY `date` ASC LIMIT '$limit'"; $results = DB::get_results($query); $code = DB::errno(); if ($code != 0){ $message = DB::error(); throw new Exception($message, $code); } return $results; } You will also have to update the module code to pass the limit parameter; public function GetProfileMail($limit){ $pid = Auth::$userinfo->pilotid; $this->set('mail', MailData::getallmail($pid, $limit)); $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid)); $this->show('mail/mail_profile.tpl'); } Quote Link to comment Share on other sites More sharing options...
Ariel Posted June 19, 2013 Report Share Posted June 19, 2013 I am assuming that you are using the latest version of AirMail - The MailData::getallmail function has no limit parameter. public static function getallmail($pid) { if(Auth::$userinfo->pilotid != $pid){ throw new Exception("This mailbox does not belong to you. If you are accessing this via an Administration module, this feature is still in development"); } $query = "SELECT * FROM `".TABLE_PREFIX."airmail` WHERE `who_to`='$pid' AND `deleted_state`='0' AND `receiver_folder`='0' ORDER BY `date` ASC"; $results = DB::get_results($query); $code = DB::errno(); if ($code != 0){ $message = DB::error(); throw new Exception($message, $code); } return $results; } It will have to be updated to include the limit, maybe something like this (using 10 as a default limit); public static function getallmail($pid, $limit = '10') { if(Auth::$userinfo->pilotid != $pid){ throw new Exception("This mailbox does not belong to you. If you are accessing this via an Administration module, this feature is still in development"); } $query = "SELECT * FROM `".TABLE_PREFIX."airmail` WHERE `who_to`='$pid' AND `deleted_state`='0' AND `receiver_folder`='0' ORDER BY `date` ASC LIMIT '$limit'"; $results = DB::get_results($query); $code = DB::errno(); if ($code != 0){ $message = DB::error(); throw new Exception($message, $code); } return $results; } You will also have to update the module code to pass the limit parameter; public function GetProfileMail($limit){ $pid = Auth::$userinfo->pilotid; $this->set('mail', MailData::getallmail($pid, $limit)); $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid)); $this->show('mail/mail_profile.tpl'); } No its still showing me all of the inbox instead of the 10 items. I changed the number to 5 and it still shows me more than that. I am using the latest version of AIRMAIL when i changed the code with what you gave me when i go to inbox i get this Fatal error: Call to undefined method Mail::inbox() in /home/vdeltaor/public_html/core/modules/Mail/Mail.php on line 40 Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 19, 2013 Author Administrators Report Share Posted June 19, 2013 Post your files to pastebin or somewhere - there must be something being left out somewhere, this works on my test install without issue. I also am not sure where this is coming from Fatal error: Call to undefined method Mail::inbox() in /home/vdeltaor/public_html/core/modules/Mail/Mail.php on line 40 The function is in the file -> https://github.com/D...s/Mail/Mail.php <- on line 58 It is the default function that is called when the module does not know what to do with a request which makes me think that you are calling the module with no specific function, which would default to the index function. Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 19, 2013 Author Administrators Report Share Posted June 19, 2013 I tried it on a windows based server and the sql query wanted to be difficult but I chnaged the last line of the query from LIMIT '$limit'"; to LIMIT $limit"; With that it works on both playforms I able to test here. Quote Link to comment Share on other sites More sharing options...
Ariel Posted June 20, 2013 Report Share Posted June 20, 2013 im still not getting it to work with your change it still shows me the full inbox here my Mail.php http://pastebin.com/Xyk20rcC Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 24, 2013 Author Administrators Report Share Posted June 24, 2013 im still not getting it to work with your change it still shows me the full inbox here my Mail.php http://pastebin.com/Xyk20rcC Change line 392 from LIMIT $limit"; to LIMIT '$limit'"; Quote Link to comment Share on other sites More sharing options...
freshJet Posted June 24, 2013 Report Share Posted June 24, 2013 The original code I posted was for AirMail 2.0 I believe, my mistake... Quote Link to comment Share on other sites More sharing options...
Luke2000 Posted August 6, 2013 Report Share Posted August 6, 2013 where can i edit the width of the "new message" box ? actually it's 778px and i want 544px. Thanks ! Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted August 19, 2013 Author Administrators Report Share Posted August 19, 2013 You are probably looking for mail_new.tpl Quote Link to comment Share on other sites More sharing options...
simonecatalano Posted August 23, 2013 Report Share Posted August 23, 2013 Thanks Quote Link to comment Share on other sites More sharing options...
FlyingMachine Posted April 21, 2015 Report Share Posted April 21, 2015 after installation this is the error Notice: The template file "/home/xxxxxx/public_html/royalairmarocvirtual/pilotcenter/xxxxxx//core/templates/mail/mail_menu.tpl" doesn't exist in /home/xxxxxx/public_html/royalairmarocvirtual/pilotcenter/home/core/classes/TemplateSet.class.php on line 248 Notice: The template file "/home/xxxxxx/public_html/royalairmarocvirtual/pilotcenter/xxxxxx//core/templates/mail/mail_inbox.tpl" doesn't exist in /home/xxxxxx/public_html/royalairmarocvirtual/pilotcenter/home/core/classes/TemplateSet.class.php on line 248 Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted April 22, 2015 Author Administrators Report Share Posted April 22, 2015 after installation this is the error Notice: The template file "/home/xxxxxx/public_html/royalairmarocvirtual/pilotcenter/xxxxxx//core/templates/mail/mail_menu.tpl" doesn't exist in /home/xxxxxx/public_html/royalairmarocvirtual/pilotcenter/home/core/classes/TemplateSet.class.php on line 248 Notice: The template file "/home/xxxxxx/public_html/royalairmarocvirtual/pilotcenter/xxxxxx//core/templates/mail/mail_inbox.tpl" doesn't exist in /home/xxxxxx/public_html/royalairmarocvirtual/pilotcenter/home/core/classes/TemplateSet.class.php on line 248 http://forum.phpvms.net/topic/18860-i-have-a-xxxxxxtpl-file-not-found-error/ Quote Link to comment Share on other sites More sharing options...
FlyingMachine Posted April 22, 2015 Report Share Posted April 22, 2015 thank your sir working perfectly ! Quote Link to comment Share on other sites More sharing options...
in2tech Posted July 11, 2015 Report Share Posted July 11, 2015 Is there a way to send AirMail automatically when a pilot registers? So right when they join and are approved they will receive AirMail from the VA instantly, like a welcome message. Thanks! Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 11, 2015 Author Administrators Report Share Posted July 11, 2015 Is there a way to send AirMail automatically when a pilot registers? So right when they join and are approved they will receive AirMail from the VA instantly, like a welcome message. Thanks! The base phpvms system already sends an email upon both user registration and approval. You could add a hook to catch that and add a pre-built airmail to the users new account. The info for the native event/hook system is here -> http://forum.phpvms.net/page/index.html/_/developers-guides/events-and-listening-for-events-r28 Quote Link to comment Share on other sites More sharing options...
Rene Posted January 25, 2017 Report Share Posted January 25, 2017 After install this error: Fatal error: Class 'MailData' not found in /home/u166215059/public_html/core/modules/Mail/Mail.php on line 59 in Line 59: $this->set('mail', MailData::getallmail(Auth::$userinfo->pilotid)); Quote Link to comment Share on other sites More sharing options...
Rene Posted January 28, 2017 Report Share Posted January 28, 2017 nobody can help? :-( Quote Link to comment Share on other sites More sharing options...
Tummi Posted March 13, 2017 Report Share Posted March 13, 2017 Fatal error: Uncaught exception 'Exception' with message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's message inbox on 03/13/2017', '2', '1489418110')' at line 2' in /home/oneengin/public_html/core/common/MailData.class.php:92 Stack trace: #0 /home/oneengin/public_html/core/modules/Mail/Mail.php(138): MailData::send_new_mail('2', '1', 'VA Discounts', 'You received a ...', 2, 1489418110) #1 /home/oneengin/public_html/core/modules/Mail/Mail.php(38): Mail->send() #2 [internal function]: Mail->index() #3 /home/oneengin/public_html/core/classes/MainController.class.php(218): call_user_func_array(Array, Array) #4 /home/oneengin/public_html/index.php(70): MainController::RunAllActions() #5 {main} thrown in /home/oneengin/public_html/core/common/MailData.class.php on line 92 after sending an airmail to all Pilots... Quote Link to comment Share on other sites More sharing options...
Moderators ProSkyDesign Posted March 14, 2017 Moderators Report Share Posted March 14, 2017 11 hours ago, Tummi said: Fatal error: Uncaught exception 'Exception' with message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's message inbox on 03/13/2017', '2', '1489418110')' at line 2' in /home/oneengin/public_html/core/common/MailData.class.php:92 Stack trace: #0 /home/oneengin/public_html/core/modules/Mail/Mail.php(138): MailData::send_new_mail('2', '1', 'VA Discounts', 'You received a ...', 2, 1489418110) #1 /home/oneengin/public_html/core/modules/Mail/Mail.php(38): Mail->send() #2 [internal function]: Mail->index() #3 /home/oneengin/public_html/core/classes/MainController.class.php(218): call_user_func_array(Array, Array) #4 /home/oneengin/public_html/index.php(70): MainController::RunAllActions() #5 {main} thrown in /home/oneengin/public_html/core/common/MailData.class.php on line 92 after sending an airmail to all Pilots... I have the same issue Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted March 26, 2017 Report Share Posted March 26, 2017 Try to escape the apostrophe? Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted October 29, 2017 Report Share Posted October 29, 2017 (edited) [SOLVED] , wonderful addon. But sadly it doesn't work on my new project. Fatal error: Uncaught exception 'Exception' with message 'Table 'tuigroupvirtual_co_uk_tuivam.phpvms_1airmail_folders' doesn't exist' in /customers/a/5/b/tuigroupvirtual.co.uk/httpd.www/core/common/MailData.class.php:364 Stack trace: #0 /customers/a/5/b/tuigroupvirtual.co.uk/httpd.www/core/modules/Mail/Mail.php(67): MailData::checkforfolders('43') #1 /customers/a/5/b/tuigroupvirtual.co.uk/httpd.www/core/modules/Mail/Mail.php(61): Mail->menu() #2 /customers/a/5/b/tuigroupvirtual.co.uk/httpd.www/core/modules/Mail/Mail.php(40): Mail->inbox() #3 [internal function]: Mail->index() #4 /customers/a/5/b/tuigroupvirtual.co.uk/httpd.www/core/classes/MainController.class.php(218): call_user_func_array(Array, Array) #5 /customers/a/5/b/tuigroupvirtual.co.uk/httpd.www/index.php(70): MainController::RunAllActions() #6 {main} thrown in /customers/a/5/b/tuigroupvirtual.co.uk/httpd.www/core/common/MailData.class.php on line 364 Any leads? Edited October 29, 2017 by LeonardIGO4036 Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted October 29, 2017 Members Report Share Posted October 29, 2017 you are missing table airmail_folders import the mysql again to your datatbase Quote Link to comment Share on other sites More sharing options...
parthprakash1 Posted November 29, 2017 Report Share Posted November 29, 2017 I get this Notice: The template file "/storage/ssd5/341/1107341/public_html//core/templates/mail/mail_menu.tpl" doesn't exist in /storage/ssd5/341/1107341/public_html/core/classes/TemplateSet.class.php on line 248 I am quite sure that the file which seems to be missing is actually present. Any leads? Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted November 30, 2017 Moderators Report Share Posted November 30, 2017 Does it exists as mail_menu.tpl or mail_menu.php? Quote Link to comment Share on other sites More sharing options...
parthprakash1 Posted December 2, 2017 Report Share Posted December 2, 2017 (edited) @servetas .tpl. I'll just rename it twice and check Edited December 2, 2017 by parthprakash1 Quote Link to comment Share on other sites More sharing options...
Cor Posted May 29, 2018 Report Share Posted May 29, 2018 On 3/13/2017 at 4:22 PM, Tummi said: Fatal error: Uncaught exception 'Exception' with message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's message inbox on 03/13/2017', '2', '1489418110')' at line 2' in /home/oneengin/public_html/core/common/MailData.class.php:92 Stack trace: #0 /home/oneengin/public_html/core/modules/Mail/Mail.php(138): MailData::send_new_mail('2', '1', 'VA Discounts', 'You received a ...', 2, 1489418110) #1 /home/oneengin/public_html/core/modules/Mail/Mail.php(38): Mail->send() #2 [internal function]: Mail->index() #3 /home/oneengin/public_html/core/classes/MainController.class.php(218): call_user_func_array(Array, Array) #4 /home/oneengin/public_html/index.php(70): MainController::RunAllActions() #5 {main} thrown in /home/oneengin/public_html/core/common/MailData.class.php on line 92 after sending an airmail to all Pilots... Did this problem get solved? And how? Regards, Cor Quote Link to comment Share on other sites More sharing options...
Ilai Posted June 13, 2018 Report Share Posted June 13, 2018 Somebody can send me skin to AIRMAIL i used the crewcenter. Quote Link to comment Share on other sites More sharing options...
flyalaska Posted June 13, 2018 Report Share Posted June 13, 2018 2 hours ago, Ilai said: Somebody can send me skin to AIRMAIL i used the crewcenter. https://github.com/DavidJClark/phpVMS-AirMail Quote Link to comment Share on other sites More sharing options...
gio1961 Posted June 24, 2018 Report Share Posted June 24, 2018 Hi everyone, someone has a pop-up form or modal window to share to view incoming emails. I found this on the net but I could not change it <div class="container"> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">EMAIL</h4> </div> <div class="modal-body"> <p><?php MainController::Run('Mail', 'checkmail'); ?></p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> </div> <?php $show_modal=false; $id = $_SESSION["id"]; $sql = "select count(*) as ct from messages where `readdate`='0000-00-00 00:00:00' and user_to=$id and status!=3"; if (!$result = $db->query($sql)) { die('There was an error running the query [' . $db->error . ']'); } while ($row = $result->fetch_assoc()) { if ($row['ct']>0) $show_modal=true; } if($show_modal):?> <script> $('#myModal').modal('show');</script> <?php endif;?> Quote Link to comment Share on other sites More sharing options...
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.