Fórumok
How to know if user is signed-in from web content display
Rupesh Chotai, módosítva 12 év-val korábban
How to know if user is signed-in from web content display
Regular Member Bejegyzések: 163 Csatlakozás dátuma: 2011.03.23. Legújabb bejegyzések
Hi All,
I want to toggle one link in web content display based on if user is signed-in or not. Is there a way I can check in web content display if user is signed-in?
Thanks for the reply.
I want to toggle one link in web content display based on if user is signed-in or not. Is there a way I can check in web content display if user is signed-in?
Thanks for the reply.
jelmer kuperus, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display
Liferay Legend Bejegyzések: 1191 Csatlakozás dátuma: 2010.03.10. Legújabb bejegyzések
This may help
http://www.liferay.com/community/forums/-/message_boards/message/4658719
http://www.liferay.com/community/forums/-/message_boards/message/4658719
Rupesh Chotai, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display
Regular Member Bejegyzések: 163 Csatlakozás dátuma: 2011.03.23. Legújabb bejegyzések
Hi Jelmer,
Thanks for the reply.
However the post you mentioned is other way round i.e. checking in velocity template if user is signed in or not.
I am looking for the check - if user is signed in or not, in web content display.
Hi Hiran,
Thanks for the reply.
I dont want to hide the whole web content display rather want to hide link in that. And just for one link, I dont think its good practice to create two separate web content display.
Thanks for the reply.
However the post you mentioned is other way round i.e. checking in velocity template if user is signed in or not.
I am looking for the check - if user is signed in or not, in web content display.
Hi Hiran,
Thanks for the reply.
I dont want to hide the whole web content display rather want to hide link in that. And just for one link, I dont think its good practice to create two separate web content display.
jelmer kuperus, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display
Liferay Legend Bejegyzések: 1191 Csatlakozás dátuma: 2010.03.10. Legújabb bejegyzések
I am not sure if i understand you then
structure + template = webcontent
The only way to do anything dynamic in webcontent is by using (velocity / xsl) templates. The post i linked explains how to check if you are logged in in a velocity template used to construct webcontent
structure + template = webcontent
The only way to do anything dynamic in webcontent is by using (velocity / xsl) templates. The post i linked explains how to check if you are logged in in a velocity template used to construct webcontent
Rupesh Chotai, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display
Regular Member Bejegyzések: 163 Csatlakozás dátuma: 2011.03.23. Legújabb bejegyzések
Hi Jelmer,
Thanks for reply.
I will explain bit more about my question:
I am using liferay web content display portlet. Added using dockbar on the page. After clicking Edit web content link for that web content, I have added some links on the web content. Now I am writing javascript function in that which should check if user is signed-in or not to toggle on of the image. However, I couldnt find yet how to retrieve user details in that javascript function.
Please let me know if you need more details around it.
Again, thanks for helping me out.
Thanks for reply.
I will explain bit more about my question:
I am using liferay web content display portlet. Added using dockbar on the page. After clicking Edit web content link for that web content, I have added some links on the web content. Now I am writing javascript function in that which should check if user is signed-in or not to toggle on of the image. However, I couldnt find yet how to retrieve user details in that javascript function.
Please let me know if you need more details around it.
Again, thanks for helping me out.
Nisarg Parikh, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display
Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.12.31. Legújabb bejegyzések
Hi Rupesh,
I guess that javascript in/for web content will not work.
You have to write your own structure and template and in template you can check weather user is logged in or not using velocity variables.
Hope that might help you.
-Nisarg
I guess that javascript in/for web content will not work.
You have to write your own structure and template and in template you can check weather user is logged in or not using velocity variables.
Hope that might help you.
-Nisarg
Rupesh Chotai, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display
Regular Member Bejegyzések: 163 Csatlakozás dátuma: 2011.03.23. Legújabb bejegyzések
Thanks Nisarg for the reply.
Can you suggest wiki/documentation explaining how to create structure & template using web content display.
Appreciated your help.
Can you suggest wiki/documentation explaining how to create structure & template using web content display.
Appreciated your help.
Nisarg Parikh, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display (Válasz)
Expert Bejegyzések: 262 Csatlakozás dátuma: 2009.12.31. Legújabb bejegyzések
Hi Rupesh,
You can refer below link
http://docs.liferay.com/portal/6.0/official/liferay-administrator-guide-6.0.pdf
there is section 4 for WCM..
Hope this helps.
-Nisarg
You can refer below link
http://docs.liferay.com/portal/6.0/official/liferay-administrator-guide-6.0.pdf
there is section 4 for WCM..
Hope this helps.
-Nisarg
Rupesh Chotai, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display
Regular Member Bejegyzések: 163 Csatlakozás dátuma: 2011.03.23. Legújabb bejegyzések
Thanks Nisarg for the details.
Victor Zorin, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display
Liferay Legend Bejegyzések: 1228 Csatlakozás dátuma: 2008.04.14. Legújabb bejegyzések
We just had a similar requirement for Liferay6.
A simplified way of detecting whether the user is logged in from within the web content and doing certain action without engaging Velocity Templates mechanism is below.
Stick the following javascript at the bottom of the web content article located on a page where you want to have this action.
This particular script will redirect the user to another page in 3 seconds if user is signed in.
It assumes that you have jQuery, modify script if you do not use it. Cookie such as COMPANY_ID is set by the portal for any signed in user.
Why 3 seconds delay? In case you want to modify the page while you are signed in. It will give enough time to click on X button to stop javascript running.
In case when in your version of portal COMPANY_ID cookie is not being set, you can use run-time detection of some content on the page, e.g. if Sign In portlet (portlet_58) displays the message "You are signed in as...";
A simplified way of detecting whether the user is logged in from within the web content and doing certain action without engaging Velocity Templates mechanism is below.
Stick the following javascript at the bottom of the web content article located on a page where you want to have this action.
This particular script will redirect the user to another page in 3 seconds if user is signed in.
<script type="text/javascript">
(function($) {
$(document).ready(function() {
if(document.cookie.indexOf("COMPANY_ID") != -1) { setTimeout("redirectToProject()", 3000); }
});
})(jQuery);
function redirectToProject()
{
document.location.href = "/group/integration-project";
}
</script>
It assumes that you have jQuery, modify script if you do not use it. Cookie such as COMPANY_ID is set by the portal for any signed in user.
Why 3 seconds delay? In case you want to modify the page while you are signed in. It will give enough time to click on X button to stop javascript running.
In case when in your version of portal COMPANY_ID cookie is not being set, you can use run-time detection of some content on the page, e.g. if Sign In portlet (portlet_58) displays the message "You are signed in as...";
<script type="text/javascript">
$(document).ready(function() {
window.alert('looking for signin portlet');
var signinPortlet = document.getElementById("portlet_58");
if(signinPortlet != null)
{
if(signinPortlet.innerHTML.indexOf("You are signed in as") > 0)
{
setTimeout("redirectToProject()", 3000);
}
} else
{
window.alert('sign-in portlet not found');
}
});
function redirectToProject()
{
window.alert("redirecting...");
document.location.href = "/group/integration-project";
}
</script>
Hiran Chaudhuri, módosítva 12 év-val korábban
RE: How to know if user is signed-in from web content display
Regular Member Bejegyzések: 188 Csatlakozás dátuma: 2010.09.01. Legújabb bejegyzésekRupesh Chotai:
Hi All,
I want to toggle one link in web content display based on if user is signed-in or not. Is there a way I can check in web content display if user is signed-in?
Thanks for the reply.
You could check for the role "user" or "community member" vs. "guest".
As the web content display would be static and not respond to such dynamic behaviour, you could create two web content displays - one for the guest and one for the other users.
Somewhere (probably look&feel) you can configure that the non-authorized user would not even see the message "not authorized", so everybody would see only one web content.
Vincent Le Borgne, módosítva 10 év-val korábban
RE: How to know if user is signed-in from web content display
New Member Bejegyzés: 1 Csatlakozás dátuma: 2013.08.06. Legújabb bejegyzések
Hi,
I use Liferay javascript API to do this.
I use Liferay javascript API to do this.
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
if(Liferay.ThemeDisplay.isSignedIn()){
}
});
</script>
Richard Lee, módosítva 10 év-val korábban
RE: How to know if user is signed-in from web content display
Junior Member Bejegyzések: 28 Csatlakozás dátuma: 2011.01.19. Legújabb bejegyzések
From my testing Liferay.ThemeDisplay.isSignedIn() only provides status at the time of the page load - i.e. it doesnt get updated by the portal automatically