2

我正在使用drupal7。我列出了用户配置文件。在用户配置文件详细信息页面中包含历史记录。它显示为“会员 22 小时 15 分钟”

我想隐藏历史部分。

4

4 回答 4

7

按照配置 -> 人员 -> 帐户设置 -> 管理显示 ( admin/config/people/accounts/display) 并将历史记录的格式设置为“隐藏”。

于 2012-11-29T07:31:23.470 回答
1

tulvit 绝对提供了最简单的解决方案,但如果您需要通过代码执行此操作,则可以使用hook_user_view_alter

在自定义模块中添加:

/**
 * Implements hook_user_view_alter().
 */
function YOURCUSTOMMODULE_user_view_alter(&$build) {
  unset($build['summary']);
}

变量 $build['summary'] 包含用于呈现用户配置文件的历史记录部分的所有信息。

于 2014-10-31T11:09:04.677 回答
0

嗨,希望这些链接对您有用 :)如何从个人资料中删除历史记录自定义用户个人资料布局

来自以上链接的点... 1.复制以下代码

<?php
// $Id: user-profile-category.tpl.php,v 1.2 2007/08/07 08:39:36 goba Exp $

/**
 * @file user-profile-category.tpl.php
 * Default theme implementation to present profile categories (groups of
 * profile items).
 *
 * Categories are defined when configuring user profile fields for the site.
 * It can also be defined by modules. All profile items for a category will be
 * output through the $profile_items variable.
 *
 * @see user-profile-item.tpl.php
 *      where each profile item is rendered. It is implemented as a definition
 *      list by default.
 * @see user-profile.tpl.php
 *      where all items and categories are collected and printed out.
 *
 * Available variables:
 * - $title: Category title for the group of items.
 * - $profile_items: All the items for the group rendered through
 *   user-profile-item.tpl.php.
 * - $attributes: HTML attributes. Usually renders classes.
 *
 * @see template_preprocess_user_profile_category()
 */
?>
<?php if ($title && $title != t(History)) : ?>
  <h3><?php print $title; ?></h3>
<?php endif; ?>

<?php if ($title != t(History)) : ?>
<dl<?php print $attributes; ?>>
  <?php print $profile_items; ?>
</dl>
<?php endif; ?>

2. 将上述代码保存在一个名为“ user-profile-category.tpl.php”的文件中(请不要使用任何其他名称,因为我们已经覆盖了 Drupal 的核心 tpl 文件)并将提到的文件保存到主题的根文件夹中,无论您使用什么... 3 . 确认您使用的是相同的主题(因为我们覆盖了特定主题的 tpl 文件) 4. 清除缓存并查看结果:)

于 2012-11-29T06:50:38.863 回答
0

管理 » 配置 » 人员 » 帐户设置 » 管理显示

于 2014-08-10T09:13:14.163 回答