2

Is it possible to override a user page with a view? I would like to override the user page to show all the nodes created by that user.

4 Answers 4

2

Views is not the right tool to use here, as views is for listing of content.

What you probably want is to use panels to take over the user page and display anything, like a view in it.

4
  • Might be better to use standard blocks than get Panels involved, it's a lot of bloat for such a simple thing
    – Clive
    Commented May 30, 2012 at 16:39
  • 2
    The OP is about a page listing all the nodes created by the user, which is content. It's not true that the Views module is for listing just content; it can create a list of users, and even a list of modules.
    – apaderno
    Commented May 30, 2012 at 16:54
  • Well sure views is for listing things, but most users understand it much easier if you don't abstract that too much. Commented May 30, 2012 at 18:22
  • Whether panels is a lot of bloat is definitive not clear as it is an intelligent system in contrast to block rendering. Commented May 30, 2012 at 18:45
1

I found the answer to this!

In Views under relationship, select Content: Author

Then in under Contextual Filters select Content Author UID Use the following settings for Content Author UID:

  • Relationship: Nodes
  • WHEN THE FILTER VALUE IS NOT AVAILABLE: Provide
  • Default Value / User ID from URL WHEN THE FILTER VALUE IS AVAILABLE OR A DEFAULT IS PROVIDED: Specify Validation Criteria / Validator: User / Allow both numeric UIDs and string usernames

Then simply create a block and display it on the user page (Go to block settings and set the path to users/*

I hope that helps someone!

0

Might not be the answer but try this module http://drupal.org/sandbox/AshishThakur/1511158

0

There is a way to replace the content of user page with views page (Tested)

function MODULE_menu_alter(&$items){
  $views_router = menu_get_item('path/to/my/views');
  if( $views_router ){
    $items['user/%user']['page callback'] = $views_router['page_callback'];
    $items['user/%user']['page arguments'] = $views_router['page_arguments'];
    $items['user/%user']['access callback'] = $views_router['access_callback'];
    $items['user/%user']['access arguments'] = unserialize($views_router['access_arguments']);
  }
}

Flush the cache and check the views accessibility settings.

Visit the user page for effective results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.