【问题标题】:How to hide "User Information" options from "My Account" in Liferay 6.1?如何在 Liferay 6.1 的“我的帐户”中隐藏“用户信息”选项?
【发布时间】:2015-04-14 22:07:22
【问题描述】:

我正在尝试使用钩子在“我的帐户”中隐藏“用户信息”中的一些选项。我只想使用 CSS (style="display:none") 隐藏它。用户信息显示在“我的帐户”页面的右侧。 我想知道,我应该在哪个页面进行更改?在创建挂钩时,我应该选择哪个页面来隐藏“组织、站点等”等链接。请帮忙...

【问题讨论】:

    标签: liferay-6 liferay-ide


    【解决方案1】:

    您必须通过在 portal-ext.properties 中编写它们来选择您想要的选项卡,如下所示:

        #
    # Input a list of sections that will be included as part of the user form
    # when updating a user in the My Account portlet.
    
    users.form.my.account.main=details,password,organizations,sites,user-groups,roles,personal-site,categorization
    users.form.my.account.identification=addresses,phone-numbers,additional-email-addresses,websites,instant-messenger,social-network,sms,open-id
    users.form.my.account.miscellaneous=announcements,display-settings,comments,custom-fields
    

    每个字段都会链接到它的jsp。例如,“详细信息”将显示 details.jsp。

    【讨论】:

      【解决方案2】:

      由于您的问题是查找 jsp 文件,您应该这样做:

      1. 下载 Liferay 源代码,并将门户主干添加为 Eclipse 中的 Liferay 项目
      2. 通过门户导航到您想要的文件(管理我的帐户),并从您的浏览器获取网址
      3. 在 usl 中搜索“struts_action”属性。对于这种情况,它是“/my_sites/view” 这非常有用,因为第一个参数表示控制 jsp 页面的 portlet。 第二个参数通常是你要搜索的jsp
      4. 在门户主干中找到该文件并搜索要编辑的 html 组件。它可能在页面本身中,也可能在包含的页面或同级页面上(作为选项卡提供)

      对于您的情况,它是“/portal-trunk/portal-web/docroot/html/portlet/users_admin/edit_user.jsp”

      【讨论】:

      • 感谢您的回复。但它不可能通过使用 css 来隐藏这些链接。我使用一些java代码隐藏它。发布为答案。
      • 是的,链接设置的方式,你必须写一些java代码。我只是试图帮助您识别文件,因为那是您所要求的。很高兴你解决了
      • 是的,仅在分析该页面后,我才明白我的计划(使用 CSS 隐藏)将不起作用:-(。感谢您帮助找到它。请查看 stackoverflow.com/questions/14659374/….. .
      【解决方案3】:

      无法使用 CSS 删除这些选项。我们可以执行以下简单的 Java 代码来删除这些选项卡...我们需要编辑的页面是“/portal-trunk/portal-web/docroot/html/portlet/users_admin/edit_user.jsp”。

      List<String> identificationList = new ArrayList<String>();
      
      for(String identificationItem : identificationSections){
          identificationList.add(identificationItem);
           System.out.println(identificationItem);
      }
      identificationList.remove("websites");
      identificationList.remove("instant-messenger");
      identificationList.remove("social-network");
      identificationList.remove("sms");
      identificationList.remove("open-id");
      
      identificationSections = new String[identificationList.size()];
      for(int i = 0; i < identificationList.size(); i++){
          identificationSections[i] =identificationList.get(i);
      }
      

      使用上面编写的简单 java 代码很容易隐藏这些链接。

      【讨论】:

        猜你喜欢
        • 2012-03-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-10-31
        • 2019-12-18
        • 1970-01-01
        • 2012-08-29
        • 1970-01-01
        相关资源
        最近更新 更多