Drupal视图:显示用户在配置文件页面上创建的最近节点 [英] Drupal Views: Display recent nodes created by user on profile page

查看:126
本文介绍了Drupal视图:显示用户在配置文件页面上创建的最近节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在用户个人资料页面上显示用户最近创建的节点。我为/ user /%用户创建了一个用户的新页面,我希望能够显示该用户创建的最新节点。

解决方案

好的,答案是创建一个drupal视图,所以你需要 views 模块,虽然简单,答案是冗长的。请耐心等待... :)(我实际上是在测试网站上做这个,因为我写的说明,以确保我不会错过任何...)



我假设你知道如何下载和安装视图模块。确保您还启用了views-ui模块。


  1. 转到网站建设 - > views-> add。

  2. 将recent_posts_by_user替换为视图名称,Recent posts by user用于描述,node用于视图类型。

  3. 在默认视图类型下,在fields块中,点击+号。

  4. 选择节点,然后检查节点类型,节点标题和节点更新日期字段。点击列表下方的添加按钮。

  5. 在基本设置块(左侧)下,点击10显示项目,并更改为5或但是,如果您需要每页多个项目,并在使用寻呼机下点击更新

  6. ,请点击否和完整的寻呼机或微型寻呼机,然后点击更新再次选择更新日期作为默认排序,然后选择默认排序,然后选择默认排序排序顺序,选择降序。点击更新。

  7. 点击保存保存您的进度。

默认视图已完成。好极了!现在可以在页面的下拉列表中添加块


  1. ,选择阻止并点击添加显示。 / li>
  2. 点击参数(屏幕中心的块标题)

  3. 点击覆盖和更新

  4. 点击组下拉菜单中参数

  5. 右侧的+号,选择用户并选择用户ID。点击添加

  6. 在如果参数不存在时采取行动,选择最后一个选项提供默认参数,从url中选择user id,然后选中一个节点,并使用验证器下的节点作者

  7. ,选择用户和允许数字UID和字符串用户名

  8. 如果参数无效,请采取行动选择隐藏视图/页面未找到(404)

  9. 点击更新然后点击保存

现在创建视图,确保它显示在正确的页面。


  1. 去建站 - >块,搜索用户最近的帖子块,然后点击配置

  2. 滚动到底部,然后选择仅显示列表页面。在页面文本区域中放入users / *

  3. 点击保存块

  4. 现在找到用户最近的帖子再次阻止并将其设置为内容底部区域(或您的主题可用的任何其他区域)。

  5. 点击保存块


  6. 完成!不是火箭科学,但漫长的过程... drupal 6意见是如此优于drupal 5! :)



    现在访问用户页面 http:// site /用户/用户名,看到表格显示在那里!



    如果您仍然对视图有任何疑问,请点击我。



    享受


    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.

    解决方案

    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...)

    i assume that you know how to download and install the views module. make sure you also enable the views-ui module.

    1. go to site building->views->add.
    2. put "recent_posts_by_user" for view name, "recent posts by user" for description and "node" for view type. hit next.
    3. under the "default" view type, on the "fields" block, hit the "+" sign.
    4. under "groups" select node, then check the "node type", "node title" and "node updated date" fields. hit the "add" button below the list.
    5. under basic settings block (on the left), click on the "10" for "items for display" and change to "5" or however many items you want per page, and hit "update"
    6. under "use pager", click on "no" and "full pager" or "mini pager" and hit "update" again.
    7. under style, hit "unformatted" and change it to "table" set all fields to sortable, then choose the "updated date" as "default sort", then on "default sort order", select "descending". hit update.
    8. hit "save" to save your progress thus far.

    default view is done. YAY! lets add the block

    1. now on the drop-down that says "page", select "block" and hit "add display".
    2. hit "arguments" (block title on the center of the screen)
    3. hit "override" and "update"
    4. hit the "+" sign to the right of "arguments"
    5. on the "groups" drop down, select "user" and select "user id". hit "add"
    6. under "Action to take if argument is not present", select the last option "provide default argument", select "user id from url" and check "Also look for a node and use the node author"
    7. under "validator", select "user" and "Allow both numeric UIDs and string usernames"
    8. under "Action to take if argument does not validate" select "hide view/page not found (404)"
    9. hit "update" then "save"

    view is created now lets make sure it shows up on the right pages.

    1. go to site building->blocks, search for the "recent posts by user" block and hit "configure"
    2. scroll all the way to the bottom and select "Show on only the listed pages." and put in "users/*" under the "pages" text area
    3. hit "save block"
    4. now find the "recent posts by user" block again and set it to "content bottom" region (or any other region your theme has available).
    5. hit "save blocks"

    DONE! Not rocket-science, but lengthy process... drupal 6 views is so much better than drupal 5! :)

    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.

    enjoy

    这篇关于Drupal视图:显示用户在配置文件页面上创建的最近节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆