Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Hide portlet sing-in after login ? Yousri BENDIABDALLAH July 2, 2009 2:17 AM
RE: Hide portlet sing-in after login ? Satish Bejgum July 6, 2009 6:10 AM
RE: Hide portlet sing-in after login ? Yousri BENDIABDALLAH July 6, 2009 6:28 AM
RE: Hide portlet sing-in after login ? Karolin Anna Heiss February 3, 2011 2:39 AM
RE: Hide portlet sing-in after login ? Ed Holderman February 3, 2011 8:28 AM
RE: Hide portlet sing-in after login ? Minhchau Dang February 9, 2011 5:12 PM
RE: Hide portlet sing-in after login ? Karolin Anna Heiss February 10, 2011 2:51 AM
RE: Hide portlet sing-in after login ? p marek March 29, 2011 4:42 PM
RE: Hide portlet sing-in after login ? Karolin Anna Heiss April 1, 2011 6:33 AM
RE: Hide portlet sing-in after login ? p marek April 1, 2011 2:57 PM
RE: Hide portlet sing-in after login ? Olaf Kock April 3, 2011 8:58 AM
RE: Hide portlet sing-in after login ? Karolin Anna Heiss April 4, 2011 8:47 AM
RE: Hide portlet sing-in after login ? Olaf Kock April 4, 2011 12:37 PM
RE: Hide portlet sing-in after login ? Sandeep Nair April 4, 2011 9:52 PM
RE: Hide portlet sing-in after login ? Karolin Anna Heiss April 7, 2011 2:27 AM
RE: Hide portlet sing-in after login ? Olaf Kock April 7, 2011 1:39 PM
RE: Hide portlet sing-in after login ? Karolin Anna Heiss April 12, 2011 7:07 AM
RE: Hide portlet sing-in after login ? Zeeshan Khan January 23, 2012 11:05 PM
RE: Hide portlet sing-in after login ? Zeeshan Khan January 24, 2012 4:56 AM
RE: Hide portlet sing-in after login ? Olaf Kock January 24, 2012 11:09 PM
RE: Hide portlet sing-in after login ? Zeeshan Khan January 24, 2012 10:17 PM
RE: Hide portlet sing-in after login ? Marc-Andre Gauthier July 30, 2015 2:03 PM
Yousri BENDIABDALLAH
Hide portlet sing-in after login ?
July 2, 2009 2:17 AM
Answer

Yousri BENDIABDALLAH

Rank: Junior Member

Posts: 70

Join Date: April 11, 2008

Recent Posts

Hello,

I'd like to hide the portlet sing-in after login? in the same page!


Thank you
Satish Bejgum
RE: Hide portlet sing-in after login ?
July 6, 2009 6:10 AM
Answer

Satish Bejgum

Rank: Junior Member

Posts: 45

Join Date: November 5, 2008

Recent Posts

go to ROOt.WAR\html\portlet\login\login.jsp and add condition not to show any thing after log-in. but if your using border, you will see the border.
Yousri BENDIABDALLAH
RE: Hide portlet sing-in after login ?
July 6, 2009 6:28 AM
Answer

Yousri BENDIABDALLAH

Rank: Junior Member

Posts: 70

Join Date: April 11, 2008

Recent Posts

Thank you
Yes I already thought about this solution
I want all the portlet is not visible even the border
Karolin Anna Heiss
RE: Hide portlet sing-in after login ?
February 3, 2011 2:39 AM
Answer

Karolin Anna Heiss

Rank: Junior Member

Posts: 53

Join Date: December 17, 2009

Recent Posts

Hello Yousri

How did you manage to completly hide the login portlet?
Please, share the solution if there is a one.

Thank you very much,
Karolin
Ed Holderman
RE: Hide portlet sing-in after login ?
February 3, 2011 8:28 AM
Answer

Ed Holderman

Rank: Junior Member

Posts: 25

Join Date: July 15, 2010

Recent Posts

I'd like to know too. I've tried using permissions to grant View access to the Login portlet to "Guest" only, but it still showed up for "User" after authentication.
Minhchau Dang
RE: Hide portlet sing-in after login ?
February 9, 2011 5:12 PM
Answer

Minhchau Dang

LIFERAY STAFF

Rank: Expert

Posts: 349

Join Date: October 22, 2007

Recent Posts

I don't think this is possible without creating an EXT plugin. You would need to implement your own PortletPermission class in an EXT plugin that has special logic when the portletId is equal to PortletKeys.LOGIN (basically, always return false in the contains method if the user is authenticated and you're checking against the login portlet).

Once it's implemented, you would need inject it by providing a bean definition in ext-spring.xml that ultimately overrides the Liferay bean with id com.liferay.portal.service.permission.PortletPermissionUtil, and make sure that it points the portletPermission property to your new implementation.
Karolin Anna Heiss
RE: Hide portlet sing-in after login ?
February 10, 2011 2:51 AM
Answer

Karolin Anna Heiss

Rank: Junior Member

Posts: 53

Join Date: December 17, 2009

Recent Posts

I am trying to follow Minhchau Dang's instructions:

PortletPermissionImpl
 1public boolean contains(
 2  PermissionChecker permissionChecker, long plid, String portletId,
 3  String actionId, boolean strict)
 4  throws PortalException, SystemException {
 5
 6  long groupId = 0;
 7  String name = null;
 8  String primKey = null;
 9  boolean isSignedIn = false; // todo: check user signed in
10
11  if (plid > 0) {
12    if (portletId.equals(PortletKeys.LOGIN)){
13      if (isSignedIn){
14        // don't show login portlet if user is logged in
15        return false;
16      }
17    }
18    .....


But how can I find out, if the user is signed in PortletPermissionImpl.contains ?

I don't have a request to find out over the themeDisplay:
1(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY)
2themeDisplay.isSignedIn()


Is there any other possibility I don't know?
p marek
RE: Hide portlet sing-in after login ?
March 29, 2011 4:42 PM
Answer

p marek

Rank: New Member

Posts: 6

Join Date: September 10, 2010

Recent Posts

I think that you can achieve what you want using a custom layout template:

1. Create a layout template with plugins SDK
2. In the .tpl file place the following code as an example:
 1<div id="main-content" role="main">
 2    <div class="portlet-layout">
 3        <div class="portlet-column" id="column-1">
 4        $processor.processColumn("column-1")
 5        </div>
 6        <div class="portlet-column" id="column-2">
 7            #if($user.isDefaultUser())
 8            $theme.runtime("58","",$velocityPortletPreferences.toString())
 9            #end
10        </div>
11    </div>
12</div>

3. Use your custom template on the page where you want the login portlet to disappear after logging in.
Karolin Anna Heiss
RE: Hide portlet sing-in after login ?
April 1, 2011 6:33 AM
Answer

Karolin Anna Heiss

Rank: Junior Member

Posts: 53

Join Date: December 17, 2009

Recent Posts

Yes, Pomocka's suggestion with a custom layout template works.

But because I want the behaviour in all standard layouts it’s not a good solution for me. I don't want to make a custom layout for all existing layouts just to hide the login portlet.

Any other solutions?
p marek
RE: Hide portlet sing-in after login ?
April 1, 2011 2:57 PM
Answer

p marek

Rank: New Member

Posts: 6

Join Date: September 10, 2010

Recent Posts

Then, add the following code to portal_normal.vm in your custom theme, just before closing </head> tag

1#if(!$user.isDefaultUser())
2#css ($htmlUtil.escape($portalUtil.getStaticResourceURL($request, "$css_folder/hide_login.css")))
3#end


and create file hide_login.css in _diffs/css with the code:

1#p_p_id_58_ { display: none; }


Hope that helps and works for you!
Olaf Kock
RE: Hide portlet sing-in after login ?
April 3, 2011 8:58 AM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 3570

Join Date: September 23, 2008

Recent Posts

You can do this with CSS only - either through the portlet's Look&Feel or in your theme:

When somebody is logged in, there's the class "signed-in", together with the portlet you can utilize the "display:none;" CSS instruction for the sign-in portlet.

I currently have no access to a running liferay (just back from vacation, this computer doesn't have any installation), so I can't check the final CSS, but it'll be like this:

1.signed-in .portlet-000 {
2  display: none;
3}


If this is ok (sign in doesn't disclose any important data), I'd opt for this than the more heavy weight modifications mentioned in this thread.
Karolin Anna Heiss
RE: Hide portlet sing-in after login ?
April 4, 2011 8:47 AM
Answer

Karolin Anna Heiss

Rank: Junior Member

Posts: 53

Join Date: December 17, 2009

Recent Posts

I tried Kock's light weight solution.

It would have to be:

1.signed-in .portlet-login {
2  display: none;
3}


But class "signed-in" is never set as well as class "signed-out"?

In init.vm I found the code with should set class "signed-in".
1#if($is_signed_in)
2  #set ($css_class = $css_class + " signed-in")
3#else
4  #set ($css_class = $css_class + " signed-out")
5#end


I surged the page source code, but class "signed-in" or "signed-out" is never set no matter if I use the standard layout or custom layout.

 1<div class="portlet-boundary portlet-boundary_58_  portlet-static portlet-static-end portlet-login " id="p_p_id_58_">
 2    <a id="p_58"/>
 3    <section id="portlet_58" class="portlet">
 4        <header class="portlet-topper">
 5            <h1 class="portlet-title">
 6            ......
 7        </div>
 8    </section>
 9</div>


Any help why class "signed-in", "signed-out" is never set?
Olaf Kock
RE: Hide portlet sing-in after login ?
April 4, 2011 12:37 PM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 3570

Join Date: September 23, 2008

Recent Posts

I don't know if I understand your question correctly: "signed-in" is set on <body>, not on the individual portlet. But as it's nested, CSS will work as expected.

Olaf
Sandeep Nair
RE: Hide portlet sing-in after login ?
April 4, 2011 9:52 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

Can you try creating a jsp hook for init.jsp of login portlet and add the following at the end

if(themeDisplay.isSignedIn()){
renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,false);

}

Regards,
Sandeep
Karolin Anna Heiss
RE: Hide portlet sing-in after login ?
April 7, 2011 2:27 AM
Answer

Karolin Anna Heiss

Rank: Junior Member

Posts: 53

Join Date: December 17, 2009

Recent Posts

I am sorry, I am not an html or css expert.
The login portlet is always visible and because I could't find "signed-in" in the html page source I thought it's not set and that's why the login portlet is always visible.


Is my configuration right? Does this work for you?

custom.css

1.signed-in .portlet-login {
2  display: none;
3}
Olaf Kock
RE: Hide portlet sing-in after login ?
April 7, 2011 1:39 PM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 3570

Join Date: September 23, 2008

Recent Posts

Karolin Anna Krieg:
1.signed-in .portlet-login {
2  display: none;
3}


That's exactly what works for me. I'm on Liferay 6 - is this the version you are on too? I tried that in the portlet's "Look and Feel/Advanced Styling" instead of custom.css, but both variants should work.

If you wonder if your theme changes are picked up, try to add
1body { background:red; }
temporarily. You will notice when this is active.

The easiest way to inspect the DOM is with firebug or the equivalent tool on your browser. The class "signed-in" is on the <body> element.

Note (some thing that I just realized): If you hide the sign in portlet when you're logged in, there's no way to ever remove it from the page, because it's not there when the administrator is logged in.

Well, it's available through firebug or other DOM manipulating measures, but it's quite hard.

Or, embed the CSS in the theme. This way you can temporarily change the theme to display it again and (e.g.) move it to a different location.
Karolin Anna Heiss
RE: Hide portlet sing-in after login ?
April 12, 2011 7:07 AM
Answer

Karolin Anna Heiss

Rank: Junior Member

Posts: 53

Join Date: December 17, 2009

Recent Posts

It was my fault. In my custom theme portal_normal.vm <body class="$css_class"> was not set.

Now it works perfectly emoticon

Thank you very much for your help!
Zeeshan Khan
RE: Hide portlet sing-in after login ?
January 23, 2012 11:05 PM
Answer

Zeeshan Khan

Rank: Expert

Posts: 349

Join Date: July 20, 2011

Recent Posts

Olaf Kock:
Karolin Anna Krieg:
1.signed-in .portlet-login {
2  display: none;
3}


That's exactly what works for me. I'm on Liferay 6 - is this the version you are on too? I tried that in the portlet's "Look and Feel/Advanced Styling" instead of custom.css, but both variants should work.

If you wonder if your theme changes are picked up, try to add
1body { background:red; }
temporarily. You will notice when this is active.

The easiest way to inspect the DOM is with firebug or the equivalent tool on your browser. The class "signed-in" is on the <body> element.

Note (some thing that I just realized): If you hide the sign in portlet when you're logged in, there's no way to ever remove it from the page, because it's not there when the administrator is logged in.

Well, it's available through firebug or other DOM manipulating measures, but it's quite hard.

Or, embed the CSS in the theme. This way you can temporarily change the theme to display it again and (e.g.) move it to a different location.



Note (some thing that I just realized): If you hide the sign in portlet when you're logged in, there's no way to ever remove it from the page, because it's not there when the administrator is logged in.



Hi Olaf !!

I have committed this mistake.....emoticon

emoticon

now plz give some idea to get rid of this.......i have tried to remove from portlet folder and putting new LOGIN folder.....but still dint succeed........
Zeeshan Khan
RE: Hide portlet sing-in after login ?
January 24, 2012 4:56 AM
Answer

Zeeshan Khan

Rank: Expert

Posts: 349

Join Date: July 20, 2011

Recent Posts

Olaf Kock:
Karolin Anna Krieg:
1.signed-in .portlet-login {
2  display: none;
3}


That's exactly what works for me. I'm on Liferay 6 - is this the version you are on too? I tried that in the portlet's "Look and Feel/Advanced Styling" instead of custom.css, but both variants should work.

If you wonder if your theme changes are picked up, try to add
1body { background:red; }
temporarily. You will notice when this is active.

The easiest way to inspect the DOM is with firebug or the equivalent tool on your browser. The class "signed-in" is on the <body> element.

Note (some thing that I just realized): If you hide the sign in portlet when you're logged in, there's no way to ever remove it from the page, because it's not there when the administrator is logged in.

Well, it's available through firebug or other DOM manipulating measures, but it's quite hard.

Or, embed the CSS in the theme. This way you can temporarily change the theme to display it again and (e.g.) move it to a different location.



Hi Olaf !!

how to recover the login portlet that has been disappeared by adding the lines in Advance Styling....?? i have a lot R & D.....but still dint get.....

thnx !!
Olaf Kock
RE: Hide portlet sing-in after login ?
January 24, 2012 11:09 PM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 3570

Join Date: September 23, 2008

Recent Posts

Zeeshan Khan:
how to recover the login portlet that has been disappeared by adding the lines in Advance Styling....?? i have a lot R & D.....but still dint get.....


Try inspecting the site with firebug or any similar tool on the browser of your least mistrust. You can inspect the DOM, manipulate the currently active DOM or CSS, i.e. show the content again (that is still there) or add the same style to a different portlet (this time with a "display:block;" instruction) and hope that it will override the other one. You might want to combine it with the "important" directive for CSS.
Zeeshan Khan
RE: Hide portlet sing-in after login ?
January 24, 2012 10:17 PM
Answer

Zeeshan Khan

Rank: Expert

Posts: 349

Join Date: July 20, 2011

Recent Posts

thnx Olaf !!
Marc-Andre Gauthier
RE: Hide portlet sing-in after login ?
July 30, 2015 2:03 PM
Answer

Marc-Andre Gauthier

Rank: New Member

Posts: 8

Join Date: July 30, 2015

Recent Posts

.signed-in .portlet-login {
display: none;
}

Works for me