2017-10-05 58 views

回答

1

Liferay JS utility的Liferay.ThemeDisplay或只是themeDisplay不隱含地包含用戶的電子郵件地址。它只公開userIduserName,而它沒有任何getUserUser對象。

但是,您可以通過使用JSP掛鉤重寫\html\common\themes\top_js.jspf來實現該目的。所有你需要做的是添加以下getUserName: function() {下面幾行:

getUserEmailAddress: function() { 
    <c:choose> 
     <c:when test="<%= themeDisplay.isSignedIn() %>"> 
      return "<%= UnicodeFormatter.toString(user.getEmailAddress()) %>"; 
     </c:when> 
     <c:otherwise> 
      return ""; 
     </c:otherwise> 
    </c:choose> 
}, 

然後你就可以通過任何Liferay.ThemeDisplay.getUserEmailAddress();themeDisplay.getUserEmailAddress();獲得用戶的電子郵件地址。

+0

我正在Liferay 7上工作..我需要編寫一個liferay模塊片段項目,麪糰是jar文件\ html \ common \ themes \ top_js.jspf –

+0

我寧願在top_js-ext.jspf中添加此函數 – ravikuwi

+0

我還沒有在Liferay 7上工作,但是你可以在'liferay-portal/portal-web/docroot/html/common/themes/top_js.jspf'中找到這個文件,並用建議的改變覆蓋它。 –

相關問題