51 minutes ago, Ither said:
this-> editprofile just pulls back up previous data
Had a suspicion that would be the case.
On the same line (The one that you just put in, Auth::$pilot = $pilot;), try and replace it with this:
Auth::$pilot = PilotData::getPilotData($pilot-\>pilotid);
If that doesn’t work, try and replace these 3 functions and see if that works for you
public function index() { if(!Auth::LoggedIn()) { $this-\>set('message', 'You must be logged in to access this feature!'); $this-\>render('core\_error.php'); return; } /\* \* This is from /profile/editprofile \*/ if(isset($this-\>post-\>action)) { if($this-\>post-\>action == 'saveprofile') { $this-\>save\_profile\_post(); return; } /\* this comes from /profile/changepassword \*/ if($this-\>post-\>action == 'changepassword') { $this-\>change\_password\_post(); } } $pilot = PilotData::getPilotData(Auth::$pilot-\>pilotid); if(Config::Get('TRANSFER\_HOURS\_IN\_RANKS') == true) { $totalhours = $pilot-\>totalhours + $pilot-\>transferhours; } else { $totalhours = $pilot-\>totalhours; } $this-\>set('pilotcode', PilotData::getPilotCode($pilot-\>code, $pilot-\>pilotid)); $this-\>set('report', PIREPData::getLastReports($pilot-\>pilotid)); $this-\>set('nextrank', RanksData::getNextRank($totalhours)); $this-\>set('allawards', AwardsData::getPilotAwards($pilot-\>pilotid)); $this-\>set('userinfo', $pilot); $this-\>set('pilot', $pilot); $this-\>set('pilot\_hours', $totalhours); $this-\>render('profile\_main.php'); CodonEvent::Dispatch('profile\_viewed', 'Profile'); }
public function editprofile() { if(!Auth::LoggedIn()) { $this-\>set('message', 'You must be logged in to access this feature!'); $this-\>render('core\_error.php'); return; } $p = PilotData::getPilotData(Auth::$pilotid); $this-\>set('userinfo', $p); $this-\>set('pilot', $p); $this-\>set('customfields', PilotData::getFieldData($p-\>pilotid, true)); $this-\>set('bgimages', PilotData::getBackgroundImages()); $this-\>set('countries', Countries::getAllCountries()); $this-\>set('pilotcode', PilotData::getPilotCode($p-\>code, $p-\>pilotid)); $this-\>render('profile\_edit.php'); }
protected function save\_profile\_post() { if(!Auth::LoggedIn()) { $this-\>set('message', 'You must be logged in to access this feature!'); $this-\>render('core\_error.php'); return; } $pilot = Auth::$pilot; //TODO: check email validity if($this-\>post-\>email == '') { $this-\>set('message', 'The email address cannot be blank.'); $this-\>render('core\_error.php'); return; } $fields = RegistrationData::getCustomFields(); if(is\_array($fields) || $fields instanceof Countable) { if(count($fields) \> 0) { foreach ($fields as $field) { $value = Vars::POST($field-\>fieldname); $value1 = DB::escape($value); if ($field-\>required == 1 && $value1 == '') { $this-\>set('message', ''.$field-\>title.' cannot be blank!'); $this-\>render('core\_error.php'); return; } } } } $params = array( 'code' =\> $pilot-\>code, 'email' =\> $this-\>post-\>email, 'location' =\> $this-\>post-\>location, 'hub' =\> $pilot-\>hub, 'bgimage' =\> $this-\>post-\>bgimage, 'retired' =\> false ); PilotData::updateProfile($pilot-\>pilotid, $params); PilotData::SaveFields($pilot-\>pilotid, $\_POST); # Generate a fresh signature PilotData::GenerateSignature($pilot-\>pilotid); PilotData::SaveAvatar($pilot-\>code, $pilot-\>pilotid, $\_FILES); $this-\>set('message', 'Profile saved!'); $this-\>render('core\_success.php'); $this-\>editProfile(); }
[END SPOILER]
[END SPOILER]