/** Return the main profile attached with this account if any.
*/
- public function profile()
+ public function profile($forceFetch = false)
{
- if (!$this->_profile_fetched) {
+ if (!$this->_profile_fetched || $forceFetch) {
$this->_profile_fetched = true;
$this->_profile = Profile::get($this);
}
{
global $globals;
- if (is_null($user) && is_null($profile)) {
+ if (is_null($user)) {
$user = S::user();
- $profile = $user->profile();
+ }
+ if (is_null($profile)) {
+ /* Always refetch the profile. */
+ $profile = $user->profile(true);
}
$email_type = "directory";
$page->assign('edu_fields', $res->fetchAllAssoc());
require_once "emails.combobox.inc.php";
- fill_email_combobox($page, $this->owner, $this->profile);
+ fill_email_combobox($page, $this->owner);
$res = XDB::query("SELECT nw.nwid AS type, nw.name
FROM profile_networking_enum AS nw
public function _prepare(PlPage &$page, $id)
{
require_once 'emails.combobox.inc.php';
- fill_email_combobox($page, $this->owner, $this->profile);
+ fill_email_combobox($page, $this->owner);
$res = XDB::query("SELECT id, name AS label
FROM profile_job_sector_enum");