Drupal 视图:在个人资料页面上显示用户最近创建的节点 [英] Drupal Views: Display recent nodes created by user on profile page
问题描述
我想知道如何在用户的个人资料页面上显示用户最近创建的节点.我在/user/%user 为用户创建了一个新页面,我希望能够显示该用户创建的最新节点.
I'm wondering how I can display the recently created nodes by a user on their profile page. I've created a new page for a user at /user/%user and I want to be able to display the latest nodes created by that user.
推荐答案
好的,答案涉及创建 drupal 视图,因此您将需要 views 模块虽然简单,但答案却很长.请耐心等待... :)(我实际上是在编写说明时在测试站点上执行此操作,以确保我不会错过任何内容...)
ok, the answer involves creating a drupal view, so you will need the views module and although simple, the answer is lengthy. please bear with me through this... :) (i am actually doing this on a test site as i write the instructions, to make sure i dont miss anything...)
我假设您知道如何下载和安装视图模块.确保您还启用了 views-ui 模块.
i assume that you know how to download and install the views module. make sure you also enable the views-ui module.
- 转到网站建设->视图->添加.
- 将recent_posts_by_user"作为视图名称,用户最近发布的帖子"作为描述,节点"作为视图类型.点击下一步.
- 在默认"视图类型下,在字段"块上,点击+"号.
- 在组"下选择节点,然后检查节点类型"、节点标题"和节点更新日期"字段.点击列表下方的添加"按钮.
- 在基本设置块(左侧)下,单击显示项目"的10"并更改为5"或每页所需的项目数量,然后点击更新"
- 在使用寻呼机"下,点击否"和完整寻呼机"或迷你寻呼机",然后再次点击更新".
- 在样式下,点击未格式化"并将其更改为表格",将所有字段设置为可排序,然后选择更新日期"作为默认排序",然后在默认排序顺序"上,选择降序".点击更新.
- 点击保存"以保存您目前的进度.
默认视图已完成.耶!让我们添加块
default view is done. YAY! lets add the block
- 现在在显示页面"的下拉菜单中,选择阻止"并点击添加显示".
- 点击参数"(屏幕中央的块标题)
- 点击覆盖"和更新"
- 点击参数"右侧的+"号
- 在组"下拉列表中,选择用户"并选择用户 ID".点击添加"
- 在如果参数不存在时采取的操作"下,选择最后一个选项提供默认参数",选择来自 url 的用户 ID"并选中同时查找节点并使用节点作者"
- 在验证器"下,选择用户"和允许数字 UID 和字符串用户名"
- 在如果参数未验证时采取的操作"下选择隐藏视图/页面未找到 (404)"
- 点击更新"然后保存"
现在创建了视图,请确保它显示在正确的页面上.
view is created now lets make sure it shows up on the right pages.
- 转到站点构建->块,搜索用户最近发布的帖子"块并点击配置"
- 一直滚动到底部并选择仅在列出的页面上显示".并在pages"文本区域下输入users/*"
- 点击保存块"
- 现在再次找到用户最近发布的帖子"块并将其设置为内容底部"区域(或您的主题可用的任何其他区域).
- 点击保存块"
完成!不是火箭科学,而是漫长的过程……drupal 6 视图比drupal 5 好得多!:)
DONE! Not rocket-science, but lengthy process... drupal 6 views is so much better than drupal 5! :)
现在去访问一个用户页面 http://site/users/username 并查看显示在那里的表格!
now go visit a user page http://site/users/username and see the table show up there!
如果您对视图仍有疑问,请联系我.
hit me up if you still have questions about views.
享受
这篇关于Drupal 视图:在个人资料页面上显示用户最近创建的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!