Drupal Views exposed filter of Author name as a drop down

后端 未结 5 1131
被撕碎了的回忆
被撕碎了的回忆 2020-12-14 04:02

This is a follow up question to Drupal Views exposed filter of Author name. The following question was answered and works. I can filter a view by user name. The user name is

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 04:36

    Yes, this is possible. Its not particularly tough to do this... but its slightly tedious. You need to create two views

    1. The first view is a list of users on your system (a View of type Users). This user list is displayed as a dropdown instead of a list (using jump menu view style). Clicking on any user within this dropdown will call the second view with the uid (user id) of the selected user as the argument in the URL. This view is a block.
    2. The second view is a simple Node listing. It is a page view at a particular URL. It takes 1 argument which is the uid (user id) of the user.

    Detailed Steps

    1. Download the Ctools module http://drupal.org/project/ctools Enable the Chaos Tools Module. This module provides a Views Style Plugin called "Jump Menu"
    2. Create a new view of type Users and NOT type Node which you usually create. In the fields add User: Name and User: uid. For the settings of User: uid, make sure you click on Rewrite the output of the field. The rewritten output of the field should be my_node_list/[uid]. Make sure you select the exclude from display checkbox.
    3. In the settings for Style in the view, select the Jump Menu style. Click on the settings for the style. Make sure the Path dropdown has User: uid choosen
    4. Add a block display to the view. Name the block User Drop Down
    5. Save the view
    6. Add the block User Drop Down to any region in your theme e.g. Content Top (usually the best) or left sidebar. Make sure the block is only visible at the urls my_node_list/* and my_node_list by setting the block visibility settings
    7. Now create another view of type Node. Add an argument field User: uid. Add the fields you are interested in e.g. Node: title, User: Name etc.
    8. Add a page display. Let the page be at the url my_node_list
    9. Save the view. Test the dropdown with its list of users on the system at http://yoursitename/my_node_list

提交回复
热议问题