Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Display email address.
I'm using $this->Context->Session->User->Name on certain texts of my forum which works fine. $this->Context->Session->User->Email on the other hand doesn't work. Nothing is displayed. The email address is public and exists.
Thanks for your help.
0
This discussion has been closed.
Comments
if (in_array($Context->SelfUrl, array("index.php", "account.php", "categories.php", "comments.php", "post.php", "search.php", "settings.php"))) { function GetPanelLinkList(&$Context) { if ($Context->Session->UserID > 0) { if (!@$UserManager) $UserManager = $Context->ObjectFactory->NewContextObject($Context, "UserManager"); $AccountUserID = ForceIncomingInt("u", $Context->Session->UserID); if (!@$AccountUser) { $AccountUser = $UserManager->GetUserById($AccountUserID); $DispFName = $AccountUser->FirstName; $DispLName = $AccountUser->LastName; $DispName = $AccountUser->Name." ".$DispFName . " " . $DispLName . " ".$AccountUser->Email; } } else { $DispName = " "; } $PanelLinkList = ""; $PanelLinkList .= "<p>Hi ".$DispName."</p>"; return $PanelLinkList; } $Panel->AddString(GetPanelLinkList($Context),13); }
function GetSessionDataById($UserID) { $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'SqlBuilder'); $s->SetMainTable('User', 'u'); $s->AddJoin('Role', 'r', 'RoleID', 'u', 'RoleID', 'left join'); $s->AddJoin('Style', 's', 'StyleID', 'u', 'StyleID', 'left join'); $s->AddSelect(array('Name', 'UserID', 'RoleID', 'StyleID', 'CustomStyle', 'UserBlocksCategories', 'DefaultFormatType', 'Preferences', 'SendNewApplicantNotifications'), 'u'); $s->AddSelect(array('PERMISSION_SIGN_IN', 'PERMISSION_RECEIVE_APPLICATION_NOTIFICATION', 'PERMISSION_HTML_ALLOWED', 'Permissions'), 'r'); $s->AddSelect('Url', 's', 'StyleUrl'); $s->AddWhere('u', 'UserID', '', $UserID, '='); $User = $this->Context->ObjectFactory->NewContextObject($this->Context, 'User'); $UserData = $this->Context->Database->Select($s, $this->Name, 'GetSessionDataById', 'An error occurred while attempting to retrieve the requested user.'); if ($this->Context->Database->RowCount($UserData) == 0) { // This warning is in plain english, because at the point that // this method is called, the dictionary object is not yet loaded // (this is called in the context object's constructor when the session is started) $this->Context->WarningCollector->Add('The requested user could not be found.'); } else { while ($rows = $this->Context->Database->GetRow($UserData)) { $User->GetPropertiesFromDataSet($rows); } } return $this->Context->WarningCollector->Iif($User, false); }
I guess you could add email in there..? Probably best to just grab the userID and use the proper look up function though..