掲示板

using the web content display with logged in user

thumbnail
9年前 に michael hamlett によって更新されました。

using the web content display with logged in user

Junior Member 投稿: 30 参加年月日: 13/05/23 最新の投稿
using the web content display with the logged in user.

in the web content display portlet, is it possible to use a substitution variable in the HTML to pass the logged in username on a URL link?
<a href="http://www.mysite.aspx?Username=[liferayloggedinuser]"> Link to my site </a>




thanks
thumbnail
9年前 に Raphael Crivelli によって更新されました。

RE: using the web content display with logged in user

Junior Member 投稿: 31 参加年月日: 12/05/14 最新の投稿
Hi Michael

You can use Velocity to get the Username and create your URL.
Try this code snippet as a Content Template.

#set( $user = $permissionChecker.getUser() )    

Username: $user.screenName<br>
E-Mail Address: $user.emailAddress

<a href="http://www.mysite.aspx?Username=$user.screenName">Your Link</a>


If you don't get the Username, please read this article:
https://www.liferay.com/de/community/wiki/-/wiki/Main/Access+Objects+from+Velocity

    #
    # Input a comma delimited list of variables which are restricted from the
    # context in Velocity based Journal templates.
    #
    journal.template.velocity.restricted.variables=



Greetz Raphael
thumbnail
9年前 に Samuel Kong によって更新されました。

RE: using the web content display with logged in user

Liferay Legend 投稿: 1902 参加年月日: 08/03/10 最新の投稿
Yes, you can. You'll need to write your own web content template to display your web content. In your template's Velocity or FreeMarker script, you can grab the current user and insert it into your link.