Hi,

Exist module or how configure view for display block show Author Name and Avatar, relative content?

Thanks

Comments

elizarraraz’s picture

Views argument for "User: uid" and set the default argument to the following php code:

if (arg(0) == 'node' && is_numeric(arg(1))) {
  $node = node_load(arg(1));
  return $node->uid;
}
else {
  return FALSE;
}
WorldFallz’s picture

Actually with views 2 you don't need to do this with code anymore-- you can select "provide default argument", "User ID from URL", then check the "Also look for a node and use the node author " option.

sylvie_n’s picture

I am using drupal 6 and the latest version of views.
I am struggling to see where this "provide default argument" option is?

Also - on the first page when creating a view should I create a "user" or a "node" view type?

many thanks

globefox’s picture

Was given almost same code by Greenman of Codepositive yesterday to enable blocks of author's own content for profile page. Use this snippet in views as the argument code with the argument selection "UID is author". So long as the content author is set to match that of the profile owner the matching content will appear.

if (!$args[0] && arg(0) == 'node' && is_numeric(arg(1)) && !arg(2)) {
  $node = node_load(arg(1));
  $args[0] = $node->uid;
}

This *may* work in 6 too??