Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Aaron Paxson
Build a User object from Blog Entry Author?
January 15, 2013 6:12 AM
Answer

Aaron Paxson

Rank: Regular Member

Posts: 103

Join Date: July 27, 2010

Recent Posts

Hi all!

I'm trying to build a User object from the Blog Entry author. I don't have much to go on, but it looks like I can get the UserID from the Blog Entry. I then try to use UserLocalServiceUtil to get a user object, but my JSP page is saying UserLocalServiceUtil() is undefined for the type.

Basically, I'm trying to lookup the GoogleProfile custom user field. So, I getUser() using the entry.getUserId() and then using ExpandoBridge, lookup the field. But, when I use:

1<%= UserLocalServiceUtil.getUser(entry.getUserId()).getExpandoBridge().getAttribute("Googleprofile") %>?rel=author' rel="author">


This does not work (returns null). Anyone have any good ideas on how to build a user object from the blog entry author?
Jan Geißler
RE: Build a User object from Blog Entry Author?
January 15, 2013 7:24 AM
Answer

Jan Geißler

Rank: Expert

Posts: 356

Join Date: July 5, 2011

Recent Posts

You should import the UserLocalServiceUtil in your jsp file.
1<%@ page import="com.liferay.portal.service.UserLocalServiceUtil" %>

Hope this helps.
Aaron Paxson
RE: Build a User object from Blog Entry Author?
January 15, 2013 9:28 AM
Answer

Aaron Paxson

Rank: Regular Member

Posts: 103

Join Date: July 27, 2010

Recent Posts

Thanks Jan. Yes, I had the page import. Didn't post it. Sorry.

Any other ideas? Is there a better way? Am I doing it correctly?

Thanks
James Falkner
RE: Build a User object from Blog Entry Author?
January 15, 2013 12:24 PM
Answer

James Falkner

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1229

Join Date: September 17, 2010

Recent Posts

Aaron Paxson:
Thanks Jan. Yes, I had the page import. Didn't post it. Sorry.

Any other ideas? Is there a better way? Am I doing it correctly?

Thanks


Be sure the custom attribute's permissions are set such that other users can 'read' the value. In particular, go to Control Panel -> Custom Fields -> User then click "Actions -> Permission" for your custom field and make sure "Guest" and/or "User" have the VIEW permissions.