Message Boards

Liferay 7 MyAccount sections

Ravi Shankar, modified 7 Years ago.

Liferay 7 MyAccount sections

Junior Member Posts: 40 Join Date: 7/13/16 Recent Posts
Hi All, i am new in liferay 7 and i am working on My Account section. Actually there are three section in myAccount (User Information, Identification and Miscellaneous) and having some fields like (Role, password, details,sites, organizations.....) but i don't want all fields so for that i gone through liferay blogs: https://web.liferay.com/web/user.26526/blog/-/blogs/removing-panels-from-my-account

i followed same process what ever suggested in blogs (i meant overriding of form navigator) , then i got my output in MyAccount section but also i am getting some disturbance in User panel. so i am going attach my screenshot of both panel (MyAccount with my output and User panel with some disturbance) so please help me.
thumbnail
David H Nebinger, modified 7 Years ago.

RE: Liferay 7 MyAccount sections

Liferay Legend Posts: 14919 Join Date: 9/2/06 Recent Posts
I had the same problem at one point developing the code, it ended up being an issue w/ the form navigator id.

The form navigator id is the overall container of all sections and panels that will be displayed. You have to ensure that your form navigator id is unique, otherwise you will be keeping the panels/sections assigned elsewhere.

For duplicate Organization panel, that can happen when you are defining multiple panels that have the same category key/key string. Remember that all of these services are cumulative - if you have 5 panels that have the same key and category key and form navigator id, they will all be added to the panel and you'll see the 5 copies.

So watch your form navigator id as well as the key and category key for all of your panels.

The way I did it, I extended all of the Liferay classes so I could reuse the key and category key but, since I was using a unique form navigator id, I only had one instance of each.
Ravi Shankar, modified 7 Years ago.

RE: Liferay 7 MyAccount sections

Junior Member Posts: 40 Join Date: 7/13/16 Recent Posts
Hi David, first i want to say thanks for reply,
For MyAccount Section What ever u have told i followed the same way, You told category key and form navigator id should be unique so for that i did make unique navigator id and category key but still i am getting same issue, where i am doing mistake i am not getting so please help me.

my code is like:
==============
1.)
package com.liferay.users.admin.web.servlet.taglib.ui.ext;
public class Constants
{
public static final String MY_ACCOUNT_PASSWORD_VISIBLE = "my.account.password.visible";
public static final String MY_ACCOUNT_ORGANIZATIONS_VISIBLE = "my.account.organizations.visible";
public static final String MY_ACCOUNT_PREFIX ="my.account.";
public static final String _myAccountPortletId = PortletProviderUtil.getPortletId(PortalMyAccountApplicationType.MyAccount.CLASS_NAME, PortletProvider.Action.VIEW);
}

2.)
@Component(
immediate = true,
property = {"form.navigator.entry.order:Integer=70"},
service = FormNavigatorEntry.class
)
public class UserPasswordFormNavigatorEntryExt extends UserPasswordFormNavigatorEntry {
private boolean visible = GetterUtil.getBoolean(PropsUtil.get(Constants.MY_ACCOUNT_PASSWORD_VISIBLE), true);
@Override
public String getFormNavigatorId() {
return Constants.MY_ACCOUNT_PREFIX + super.getFormNavigatorId();
}
@Override
public boolean isVisible(User user, User selUser) {
return visible && super.isVisible(user, selUser);
}

3).
@Component(
property = {"form.navigator.entry.order:Integer=70"},
service = FormNavigatorEntry.class
)
public class UserPasswordFormNavigatorEntry extends BaseUserFormNavigatorEntry {
@Override
public String getCategoryKey() {
return FormNavigatorConstants.CATEGORY_KEY_USER_USER_INFORMATION;
}
@Override
public String getKey() {
return "password";
}
@Override
public boolean isVisible(User user, User selUser) {
if (selUser == null) {
return false;
}
return true;
}

@Override
protected String getJspPath() {
return "/user/password.jsp";
}

4.) properties file:
my.account.organizations.visible=false
my.account.sms.visible=false
my.account.password.visible=false
thumbnail
David H Nebinger, modified 7 Years ago.

RE: Liferay 7 MyAccount sections

Liferay Legend Posts: 14919 Join Date: 9/2/06 Recent Posts
Do you have your module and my module deployed at the same time?