留言板

Manage my account url for vm file.

thumbnail
Tanaji M. Londhe,修改在11 年前。

Manage my account url for vm file.

Regular Member 帖子: 194 加入日期: 12-4-25 最近的帖子
Hi,
How do I get url for Manage My Account. Which is pop-up click on the username link after successful login.

Thanks & regards,
Tanaji.
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Manage my account url for vm file.

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
you can follow same procedure mentioned in http://www.liferaysolution.com/2012/02/create-account-url-in-velocity-template.html

In suggested link we have created link for create account, so same way you can manage it for manage account link and set necessary parameter in URL itself.
thumbnail
Tanaji M. Londhe,修改在11 年前。

RE: Manage my account url for vm file.

Regular Member 帖子: 194 加入日期: 12-4-25 最近的帖子
LiferayPortletURL.create(javax.servlet.http.HttpServletRequest request, String portletName, long plid, String lifecycle)
I use following code as per your suggestion
#set ($manage_my_account_url = $portletURLFactory.create($request, "2", $page.getPlid(), "ACTION_PHASE"))
$manage_my_account_url.setWindowState("MAXIMIZED")
$manage_my_account_url.setPortletMode("VIEW")
$manage_my_account_url.setParameter("saveLastPath", "0")
$manage_my_account_url.setParameter("struts_action", "/my_account/edit_user")

It generates following URL.
"http://localhost:8080/web/guest/welcome?p_auth=2kZjemVr&p_p_auth=DU7v1SSr&p_p_id=2&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&saveLastPath=0&_2_struts_action=%2Fmy_account%2Fedit_user"

It shows me one portlet on portal page and gives error message is "My Account is temporarily unavailable."

and it shows error on console

11:55:50,899 WARN [PortletRequestProcessor:166] This URL can only be invoked using POST: /web/guest/welcome?p_auth=2kZjemVr&p_p_auth=DU7v1SSr&p_p_id=2&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&saveLastPath=0&_2_struts_action=%2Fmy_account%2Fedit_user
11:55:50,908 ERROR [render_portlet_jsp:154] com.liferay.portal.security.auth.PrincipalException: /web/guest/welcome?p_auth=2kZjemVr&p_p_auth=DU7v1SSr&p_p_id=2&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&saveLastPath=0&_2_struts_action=%2Fmy_account%2Fedit_user
at com.liferay.portal.struts.PortletRequestProcessor.process(PortletRequestProcessor.java:171)
at com.liferay.portlet.StrutsPortlet.processAction(StrutsPortlet.java:190)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:651)
at com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:686)
at com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:361)
at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:845)
at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:633)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:244)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:174)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:533)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

Please tell me how to resolve this issue.
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Manage my account url for vm file.

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
Very simple way to get my account URL is :

$theme_display.getURLMyAccount().toString()

So now only thing you may have to do it open this URL in popup.
thumbnail
Tanaji M. Londhe,修改在11 年前。

RE: Manage my account url for vm file.

Regular Member 帖子: 194 加入日期: 12-4-25 最近的帖子
Hi Jignesh,
I use this code as per ur suggestion
<a href="$theme_display.getURLMyAccount().toString()">$my_account_text</a>
but it shows me whole control panel with its all functionality. I dont want to show all control panel.
I just require to display user account information(My Account) which is shows in Manage My Account pop-up when user click on username link.

How to resovle this issue?
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Manage my account url for vm file.

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
Yeah but strange as both URL are referring same path

So definitely there would be something with popup
thumbnail
Tanaji M. Londhe,修改在11 年前。

RE: Manage my account url for vm file.

Regular Member 帖子: 194 加入日期: 12-4-25 最近的帖子
Hi Jignesh,
I am not getting what ur saying.....
or Is their any way to get only My Account info nothing else, When click on my link like "My Account"
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Manage my account url for vm file.

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
URL which is given in user name link in docbar and url which we are getting in theme, both are same.

You can check below section in docbar.js file to get more idea :


var myAccount = A.one('#' + namespace + 'userAvatar .user-links');

				if (myAccount) {
					myAccount.delegate(
						'click',
						function(event) {
							event.preventDefault();

							var currentTarget = event.currentTarget;

							var controlPanelCategory = Lang.trim(currentTarget.attr('data-controlPanelCategory'));

							var uri = currentTarget.attr('href');
							var title = currentTarget.attr('title');

							if (controlPanelCategory) {
								uri = Liferay.Util.addParams('controlPanelCategory=' + controlPanelCategory, uri) || uri;
							}

							instance._openWindow(
								{
									dialog: {
										align: Util.Window.ALIGN_CENTER,
										width: 960
									},
									title: title,
									uri: uri
								}
							);
						},
						'a.use-dialog'
					);
thumbnail
Tanaji M. Londhe,修改在11 年前。

RE: Manage my account url for vm file.

Regular Member 帖子: 194 加入日期: 12-4-25 最近的帖子
Hi Jignesh,

Can you please tell me how to write this code in velocity

PortletURLImpl myAccountURL = new PortletURLImpl( request, PortletKeys.MY_ACCOUNT, controlPanelPlid,PortletRequest.RENDER_PHASE);
myAccountURL.setWindowState(WindowState.MAXIMIZED);
myAccountURL.setPortletMode(PortletMode.VIEW);
myAccountURL.setRefererPlid(plid);
myAccountURL.setParameter("struts_action", "/my_account/edit_user");
myAccountURL.setParameter("backURL", myAccountRedirect);
themeDisplay.setURLMyAccount(myAccountURL);

I think using this code I can solve my issue of a Manage My Account url related.
Because as you said above post from that i search dockbar.jsp page in that i found this following code
<aui:a cssClass="user-fullname use-dialog" data-controlPanelCategory="<%= PortletCategoryKeys.MY %>" href="<%= themeDisplay.getURLMyAccount().toString() %>" title="manage-my-account"><%= HtmlUtil.escape(user.getFullName()) %></aui:a>
Here they metion PortletCategoryKeys, due this I think i am not getting that pop-up window.
thumbnail
Tejas Kanani,修改在11 年前。

RE: Manage my account url for vm file.

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
Hi Tanaji,

Just use below code in your template file. It will simply open only my account page without any other Control Panel options.

#set ($myaccurl = $theme_display.getURLMyAccount().toString() + "&amp;controlPanelCategory=my")
<a class="user-fullname use-dialog" href="$myaccurl">$my_account_text</a>


But its not opening in popup same as given in OOTB dockbar. So if you need it you just have to find a way to open it in popup.

Thanks & Regards,
Tejas
thumbnail
Tanaji M. Londhe,修改在11 年前。

RE: Manage my account url for vm file.

Regular Member 帖子: 194 加入日期: 12-4-25 最近的帖子
Hi Tejas,
Thanks you very much Tejas & Jignesh. Its working properly.
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Manage my account url for vm file.

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
That's great Tanaji
You can make this thread post status to answered now.emoticon
thumbnail
Tanaji M. Londhe,修改在11 年前。

RE: Manage my account url for vm file.

Regular Member 帖子: 194 加入日期: 12-4-25 最近的帖子
Hi Tejas,
I have created url for My Account as per ur suggestion but it doesn't show the dockbar. How to add Back link.
Riley Pickerl,修改在10 年前。

RE: Manage my account url for vm file.

Junior Member 帖子: 50 加入日期: 13-1-10 最近的帖子
Tejas Kanani:
Hi Tanaji,
But its not opening in popup same as given in OOTB dockbar. So if you need it you just have to find a way to open it in popup.

Do you know how to open it the same way as the dockbar? I thought you had to include the class use-dialog but it doesnt seem to be working for me.

Any ideas?
saritha reddy,修改在10 年前。

RE: Manage my account url for vm file.

Junior Member 帖子: 95 加入日期: 14-1-27 最近的帖子
Hi

I have followed the steps which you have provided.

But am getting not found error....

In My init.vm file i have did following
#if ($show_my_account)
#set ($my_account_text = $languageUtil.get($locale, "my-account"))
#set ($my_account_url = $theme_display.getURLMyAccount())

#end

then am trying with http://localhost:8080/web/guest/$my_account_url still same error.


Please help me with this issue.


Thanks in advance

Regards
Saritha
thumbnail
Dhrutika Vyas,修改在10 年前。

RE: Manage my account url for vm file.

Expert 帖子: 435 加入日期: 09-2-9 最近的帖子
Hi Sarita,

Try to print $my_account_url and $show_my_account variables in portal_normal.vm.

Also if you are implementing this as part of your theme, it will be in int_custom.vm in place of int.vm

Regards,
Dhrutika
thumbnail
Enrique Valdes Lacasa,修改在8 年前。

RE: Manage my account url for vm file.

Junior Member 帖子: 92 加入日期: 14-7-29 最近的帖子
It is weird, the snippet from Tejas Kanani seemed to work for me at the beginning, opening My Account in a pop up. It seems that right now that is not the case, and the My Account link that I created doesn't display any pop up. The "use-dialog" class, as a user above mentioned, is what I thought that made opening this pop up possible...but it is not working.

If someone could shed more light on this that would be great.

Thank you all for the contributions!
thumbnail
Soori Babu Meesala,修改在8 年前。

RE: Manage my account url for vm file.

Junior Member 帖子: 43 加入日期: 14-7-10 最近的帖子
Hi follow this link that might be useful. Click Here

~Regards,
Soori Babu Meesala
thumbnail
Enrique Valdes Lacasa,修改在8 年前。

RE: Manage my account url for vm file.

Junior Member 帖子: 92 加入日期: 14-7-29 最近的帖子
Thanks Soori Babu Meesala! I had forgotten to subscribe, so I didn´t know you answered. A co worker and I just found the solution on our side (we wish we had seen yours first)... and it is exactly as shown in the link you posted, so thanks a lot, it is what we were looking for.

We figured it out when we noticed that the Login portlet actually does the same functionality when logging in into Liferay, and it says: You are signed in as User YourUser. The name of the user is a link to pop up the user's profile. So we noticed that this link was different from the one in the dockbar, and they used the specific javascript function that we are talking about. Having a look at the login.jsp, it gave us exactly what we needed.

Summarizing with a solution for anyone interested in Liferay 6.2 for this, will be:

## Liferay pop up link to display the account editing page of a user (Velocity)
#set ($my_account_url = $theme_display.getURLMyAccount() + "&amp;controlPanelCategory=my")
<a href="javascript:Liferay.Util.openWindow({dialog: {destroyOnHide: true}, title: 'My Account', uri: '$my_account_url'});">
</a>