Forums

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

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Vergil Theng Soo Tan
get Organization Name at Theme
July 8, 2010 2:46 AM
Answer

Vergil Theng Soo Tan

Rank: Junior Member

Posts: 53

Join Date: January 7, 2010

Recent Posts

I need to show/hide several images in my theme, according to the organization which user has logged into, how do i get the current organization name or id with VM?

Thank and regard
Suhail Ahmed
RE: get Organization Name at Theme
July 8, 2010 3:25 AM
Answer

Suhail Ahmed

Rank: Regular Member

Posts: 126

Join Date: January 1, 2008

Recent Posts

Hi Vergil,


It is already define in init.vm of portal srouce code, if have srouce code then init.vm, you can take what you want for your purpose,

 1
 2path: liferay-portal-src-5.2.3\portal-web\docroot\html\themes\_unstyled\templates\init.vm
 3
 4----------For Company----------
 5
 6#set ($company_id = $company.getCompanyId())
 7#set ($company_name = $company.getName())
 8#set ($company_logo = $theme_display.getCompanyLogo())
 9#set ($company_logo_height = $theme_display.getCompanyLogoHeight())
10#set ($company_logo_width = $theme_display.getCompanyLogoWidth())
11#set ($company_url = $theme_display.getURLHome())
12
13----------For User----------
14#set ($user_id = $user.getUserId())
15#set ($is_default_user = $user.isDefaultUser())
16#set ($user_first_name = $user.getFirstName())
17#set ($user_middle_name = $user.getMiddleName())
18#set ($user_last_name = $user.getLastName())
19#set ($user_name = $user.getFullName())
20
21more......




Thanks

Suhail Ahmed
Vergil Theng Soo Tan
RE: get Organization Name at Theme
July 8, 2010 6:51 PM
Answer

Vergil Theng Soo Tan

Rank: Junior Member

Posts: 53

Join Date: January 7, 2010

Recent Posts

Thank Suhail Ahmed for your kind information

i check through the init.vm, but i cannot find any variable that will show the current organization name, this make me very headache.


anyone have any idea how to do this?

My scenario is
I have 2 organization, both using the same theme

i wanna show div according to the organization the user at.


Thank and regard
Suhail Ahmed
RE: get Organization Name at Theme
July 9, 2010 3:39 AM
Answer

Suhail Ahmed

Rank: Regular Member

Posts: 126

Join Date: January 1, 2008

Recent Posts

Hi Vergil,

I am trying to solve this issue, below these are needed to find you organization,

you will get all Organizations




#set ($user_group = $user.getGroup())
#set ($user_organizations = $user.getOrganizations())




hop this work you otherwise, let try together



Thanks


Suhail Ahmed
Vergil Theng Soo Tan
RE: get Organization Name at Theme
July 13, 2010 12:26 AM
Answer

Vergil Theng Soo Tan

Rank: Junior Member

Posts: 53

Join Date: January 7, 2010

Recent Posts

thank suhail ahmed

unfortunately its cannot be use for my situation, my situation is

I have 2 organization which using the same theme, but i wanna restrict the components appear depend on the organization id or name.

So i really need to get the id or name to different them
Oliver Bayer
RE: get Organization Name at Theme
July 13, 2010 1:54 AM
Answer

Oliver Bayer

Rank: Liferay Master

Posts: 883

Join Date: February 18, 2009

Recent Posts

Vi Vergil,

try the following code snippets, at least one of them should work for you.
1$page.getGroupId()
2...
3$layout.getGroup()
4...
5$layout.getScopeGroup()

From the group object you can get e.g. the name or friendlyurl to compare to of the group the user is on. Take a look at the group_ table or the group model to see the other values you can retrieve.

HTH Oli
sam del
Get Organization Name at Theme
December 4, 2010 12:25 AM
Answer

sam del

Rank: New Member

Posts: 12

Join Date: May 7, 2010

Recent Posts

Thanks for all your comments.
I'd like to see organization unit name ,Finally I found instruction in VM Liferay.
It was $organization.getName()
But if we were in Commodity Pages we can use $page.getGroup().getName() to get Commodity Name.
Dinesh Balaji
RE: Get Organization Name at Theme
January 6, 2011 2:24 AM
Answer

Dinesh Balaji

Rank: Junior Member

Posts: 52

Join Date: October 6, 2010

Recent Posts

Hi,
Currently I am using Liferay 6.

We also got a similar situation. We have 10 organisation , and we want different theme to be applied to different useres based on the organisaton they are in . I dont want this to do manually. Can we achieve this in portal-ext.properties or VM files.

Regards,
Dinesh Balaji V