Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Richard Gibson
Change user portrait from plugin portlet
April 20, 2011 3:46 AM
Answer

Richard Gibson

Rank: Junior Member

Posts: 30

Join Date: February 19, 2010

Recent Posts

Hi,

I'm trying to use the standard Liferay link to change the current users portrait picture from my plugin portlet.

I have defined the following render URL which targets the Liferay ENTERPRISE_ADMIN portlet:

1<liferay-portlet:renderURL portletName="<%=PortletKeys.ENTERPRISE_ADMIN %>" windowState="<%= LiferayWindowState.POP_UP.toString() %>" var="editPortraitURL">
2  <portlet:param name="struts_action" value="/enterprise_admin/edit_user_portrait" />
3  <portlet:param name="redirect" value="<%= currentURL %>" />
4  <portlet:param name="p_u_i_d" value="${user.userId }" />
5  <portlet:param name="portrait_id" value="${user.portraitId }" />
6</liferay-portlet:renderURL>


This is then plugged into the logo-selector tag:

1<liferay-ui:logo-selector defaultLogoURL="${portraitURL }" editLogoURL="${editUserPortraitURL }" imageId="${user.portraitId}" logoDisplaySelector=".user-logo" showBackground="${false }" />


When I click the 'change' link under the profile picture I get an error:

Portlet is temporarily unavailable.


Putting a break point on the enterprise admin portlet show that it is never getting called.

Anyone have any ideas what to do next, I don't want to replicate the code in edit_user_portrait in my own code.
Amos Fong
RE: Change user portrait from plugin portlet
April 21, 2011 2:20 AM
Answer

Amos Fong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1844

Join Date: October 7, 2008

Recent Posts

Hi Richard,

Is there any errors in the console log?
Richard Gibson
RE: Change user portrait from plugin portlet
April 26, 2011 1:47 AM
Answer

Richard Gibson

Rank: Junior Member

Posts: 30

Join Date: February 19, 2010

Recent Posts

Amos Fong:

Is there any errors in the console log?


No, there is nothing appearing in the console at all when I click this link.
tom aronsons
RE: Change user portrait from plugin portlet
May 23, 2011 4:40 PM
Answer

tom aronsons

Rank: New Member

Posts: 21

Join Date: April 28, 2011

Recent Posts

Did you find an answer? I've tried everything. These things look so obvious that everyone who customize liferay would use it, but seems like no one knows how to do it.
Richard Gibson
RE: Change user portrait from plugin portlet
May 24, 2011 1:42 AM
Answer

Richard Gibson

Rank: Junior Member

Posts: 30

Join Date: February 19, 2010

Recent Posts

No, I didn't find out how to do this, and there were no more suggestions from the Liferay staff.

You are right, these should all be in a common area that anyone developing plugin portlets can call into, not hidden away in the core of Liferay.
Rohit Salecha
RE: Change user portrait from plugin portlet
May 24, 2011 2:10 AM
Answer

Rohit Salecha

Rank: Junior Member

Posts: 50

Join Date: February 20, 2011

Recent Posts

for Liferay Alloy UI

http://liferaydemystified.blogspot.com/2011/04/mvcportlet-framework.html

for liferay ui taglib

http://liferaydemystified.blogspot.com/2011/05/liferay-ui-tabs.html
Richard Gibson
RE: Change user portrait from plugin portlet
May 24, 2011 2:13 AM
Answer

Richard Gibson

Rank: Junior Member

Posts: 30

Join Date: February 19, 2010

Recent Posts

Thanks for the links, but how do those help with this error?
tom aronsons
RE: Change user portrait from plugin portlet
May 24, 2011 10:26 AM
Answer

tom aronsons

Rank: New Member

Posts: 21

Join Date: April 28, 2011

Recent Posts

I'm wondering if we have to build our portlets in struts extension in order to use pages from liferay core.
Jelmer Kuperus
RE: Change user portrait from plugin portlet
May 24, 2011 1:24 PM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

I imagine you would have to add the portlet id of the enterprise admin portlet (id 79) to the resource check whitelist

eg add the following line to portal-ext.properties

1portlet.add.default.resource.check.whitelist=58,86,87,88,103,113,145,79
tom aronsons
RE: Change user portrait from plugin portlet
May 24, 2011 4:30 PM
Answer

tom aronsons

Rank: New Member

Posts: 21

Join Date: April 28, 2011

Recent Posts

Nope
Sergio Cabrera
RE: Change user portrait from plugin portlet
January 24, 2012 5:21 AM
Answer

Sergio Cabrera

Rank: Junior Member

Posts: 68

Join Date: December 19, 2011

Recent Posts

I don't know if you still need it, but it happens the same to me and i got it working changing to my_account:

1<liferay-portlet:renderURL portletName="<%=PortletKeys.MY_ACCOUNT %>" windowState="<%= LiferayWindowState.POP_UP.toString() %>" var="editPortraitURL">
2  <portlet:param name="struts_action" value="/my_account/edit_user_portrait" />
3  <portlet:param name="redirect" value="<%= currentURL %>" />
4  <portlet:param name="p_u_i_d" value="${user.userId }" />
5  <portlet:param name="portrait_id" value="${user.portraitId }" />
6</liferay-portlet:renderURL>
Oliver Teichmann
RE: Change user portrait from plugin portlet
November 27, 2012 10:24 AM
Answer

Oliver Teichmann

Rank: New Member

Posts: 2

Join Date: April 12, 2011

Recent Posts

Hi,

how did you provide the changePortrait JavaScript method that is called after the save action?

I get the following error "opener._2_changePortrait is not a function"

The namespace of my_profile is used obviously.
Sergio Cabrera
RE: Change user portrait from plugin portlet
January 14, 2013 1:27 AM
Answer

Sergio Cabrera

Rank: Junior Member

Posts: 68

Join Date: December 19, 2011

Recent Posts

I have this code in the opener:

 1
 2        function _no_namespace_changePortrait(newPortraitURL, newPortraitId) {
 3       
 4            <portlet:namespace/>portraitId_var = newPortraitId;
 5            
 6            var A = AUI();
 7   
 8            A.one('#<portlet:namespace />avatar').attr('src', newPortraitURL);
 9            A.one('.avatar').attr('src', newPortraitURL);
10   
11            A.one('#<portlet:namespace />deletePortrait').val(false);
12       
13        }