Foros de discusión

Create-account URL in Velocity template (Liferay 6.1)

Thibault Boyeux, modificado hace 12 años.

Create-account URL in Velocity template (Liferay 6.1)

New Member Mensajes: 12 Fecha de incorporación: 27/07/09 Mensajes recientes
Hello everyone,

In Liferay 6.1, you can no longer do themeDisplay.getURLCreateAccount() to create a link towards the account creation page in your Velocity theme template.

Indeed, the method has been removed from the ThemeDisplay API.

How could I include this link within my theme Velocity template now that this is not available any longer?

Thank you very much for your help!
thumbnail
Sandeep Nair, modificado hace 12 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
Hi,

Can you try like this in your vm

#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState(WindowState.MAXIMIZED);
$create_account_url.setPortletMode(PortletMode.VIEW);
$create_account_url.setParameter("saveLastPath", "0");
$create_account_url.setParameter("struts_action", "/login/create_account");

and then use $create_account_url

Regards,
Sandeep
Thibault Boyeux, modificado hace 12 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Mensajes: 12 Fecha de incorporación: 27/07/09 Mensajes recientes
Hi Sandeep,

Thank you very much for your precious help. I didin't know one could PortletURLFactory in Velocity (I should have checked the VelocityVariables file, my mistake).

I ended up using this code:

#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState("maximized")
$create_account_url.setPortletMode("view")
$create_account_url.setParameter("saveLastPath", "0")
$create_account_url.setParameter("struts_action", "/login/create_account")


Indeed, Velocity cannot easily retrieve static constants from Java classes (or I don't know how), such as WindowState.MAXIMIZED and PortletMode.VIEW.

It is not optimal to write them directly as strings, but I think the string values of these two constants shouldn't change soon!


Best,
Thibault.
thumbnail
Tanaji M. Londhe, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Mensajes: 194 Fecha de incorporación: 25/04/12 Mensajes recientes
Hi,

Liferay 6.1 version does not support "themeDisplay.getURLCreateAccount()" ,so I used following code as it is in my vm file but cant work
#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState(WindowState.MAXIMIZED);
$create_account_url.setPortletMode(PortletMode.VIEW);
$create_account_url.setParameter("saveLastPath", "0");
$create_account_url.setParameter("struts_action", "/login/create_account");

So please anybody tell me link for Create-Account URL for liferay 6.1
thumbnail
Sandeep Nair, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
Dont use WindowState or PortletMode, use the string values directly as

$create_account_url.setWindowState("maximized")
$create_account_url.setPortletMode("view")
thumbnail
Tanaji M. Londhe, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Mensajes: 194 Fecha de incorporación: 25/04/12 Mensajes recientes
Hi Sandeep,
I make changes as per your suggestion but generates url this one "http://localhost:9090/create_account_url" , So what is issue i cant find out.

#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState("maximized");
$create_account_url.setPortletMode("view");
$create_account_url.setParameter("saveLastPath", "0");
$create_account_url.setParameter("struts_action", "/login/create_account");

<a href="create_account_url">Register</a>

It throughs exception : 07:25:04,140 INFO [PortalImpl:4873] Current URL /create_account_url generates exception: null



Thanks & regards,
Tanaji Londhe.
thumbnail
Sandeep Nair, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
You havent used the variable in anchor tag properly. Please put $
<a href="$create_account_url">Register</a>
thumbnail
Tanaji M. Londhe, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Mensajes: 194 Fecha de incorporación: 25/04/12 Mensajes recientes
Hi Sandeep,

Sorry I forgot to write "$" in vm file. Thanx it works properly.
Sylvain Fournier, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Mensaje: 1 Fecha de incorporación: 19/07/12 Mensajes recientes
How do you manage multi language for your label "Register"
thumbnail
Pablo Rendón, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Mensajes: 8 Fecha de incorporación: 29/12/11 Mensajes recientes
Hello,

I'm trying to get the categories with the link in a VM template, but I can't even make this works, this is what I'm doing:

#set ($create_account_url = $portletURLFactory.create($request, "58", $page.getPlid(), "ACTION_PHASE"))
$create_account_url.setWindowState("maximized");
$create_account_url.setPortletMode("view");
$create_account_url.setParameter("saveLastPath", "0");
$create_account_url.setParameter("struts_action", "/login/create_account");

<a href="$create_account_url">Register</a>

and I have a link like "http://localhost:8080/web/guest/$thisportlet_url"
I think is a problem related with the $page, because when I try to render the $page.getPlid() I just get "$page.getPlid()" instead of the value, I've modified the portal-ext.properties to add "journal.template.velocity.restricted.variables=" but still doesn't work emoticon

any clue what I'm doing wrong?

Thank you!
thumbnail
Durgaprasad Lagadapati, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Mensajes: 10 Fecha de incorporación: 25/05/12 Mensajes recientes
Can we use LoginUtil.getURLCreateAccount(request,themeDisplay) as suggested in http://www.liferay.com/community/wiki/-/wiki/Main/Upgrade+6.0+plugins+to+6.1?
John Carter, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Junior Member Mensajes: 53 Fecha de incorporación: 18/10/12 Mensajes recientes
Durgaprasad Lagadapati:
Can we use LoginUtil.getURLCreateAccount(request,themeDisplay) as suggested in http://www.liferay.com/community/wiki/-/wiki/Main/Upgrade+6.0+plugins+to+6.1?


Durgaprasad,
I have checked the LoginUtil class in LR6.1.1 GA2 there is no such method,but if it's about account url for the login user then you can use
"$theme_display.getURLMyAccount()"

in theme .
Beppo Ivel, modificado hace 9 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Mensajes: 112 Fecha de incorporación: 9/04/14 Mensajes recientes
I also tried to build a URL but in I use freemarker template. My question is how I get the variable ${page}? If I try to call:

&lt;#assign updateURL = portletURLFactory.create(request,"169_INSTANCE_X4hfOUKZyDvi", page.getPlid() ,"RENDER_PHASE")&gt;


I get the error:

Expression page is undefined on line 55, column 122 in 10157#10197#11814.
thumbnail
Sandeep Nair, modificado hace 9 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
Replace "page" with "layout".

Regards,
Sandeep
Sriram Moola, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Mensajes: 2 Fecha de incorporación: 20/07/12 Mensajes recientes
HI Sandeep,

I've followed your steps in creating account url in velocity template. The url is generating fine, but the problem i'm facing is with a parameter p_p_lifecyle. Below is the url

http://localhost:8080/home?p_auth=1KMIMM5l&p_p_id=58&p_p_lifecycle=1&p_p_state=maximized&p_p_mode=view&saveLastPath=0&_58_struts_action=%2Flogin%2Fcreate_account

It's giving me Sigin is temporarily not available. When i change the p_p_lifecylcle paramter value to 0, it's working fine so can you please suggest me what should i do to set p_p_lifecycle parameter.
Sriram Moola, modificado hace 11 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

New Member Mensajes: 2 Fecha de incorporación: 20/07/12 Mensajes recientes
Hi Guys,

I've found the solution for my issue, using RENDER_PHASE instead of ACTION_PHASE fixed the issue.
Beppo Ivel, modificado hace 9 años.

RE: Create-account URL in Velocity template (Liferay 6.1)

Regular Member Mensajes: 112 Fecha de incorporación: 9/04/14 Mensajes recientes
I already used RENDER_PHASE, I was looking for themeDisplay.getPlid(). Do you know how to get the themeDisplay.getPortletDisplay().getId()? This question is related to this thread.