I have my views set up so that its filters all the nodes by the authors name in the argument

the url is set up as /content/author/$arg

Now I would like to provide information about the author in the header. If I can figure out how to print $arg then I should have no problem with the rest.

Ive tried

<?php print $arg ?>

and

<php print $views->arg ?>

as well as a few other things. Can someone help me out please?

Comments

TheOldGuy223’s picture

ok I figured it out using

 $x=arg(2);
  print $x;

Now the last thing I need to do is print the authors picture

Since Im in a view and not a node the usual

print $node->picture

wont work

Any ideas how I can pass the value of $arg and return the path of the authors picture?

dawehner’s picture

can you print out was $x is?

is this the username or the uid?

TheOldGuy223’s picture

$x is the username

dawehner’s picture


<?php
$x = arg(2);
$account = user_load('name' => $x);
$picture = $account->picture;

TheOldGuy223’s picture

when I use that code I get a

Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/--------/--------/includes/common.inc(1355) : eval()'d code on line 54

junedkazi’s picture

I think the $account statement is wrong

It should be
$account = user_load(array('name' => $x));

Hope this helps.

Thanks

Juned Kazi

dawehner’s picture

oh sry

<?php
$x = arg(2);
$account = user_load(array('name' => $x));
$picture = $account->picture;
?>
TheOldGuy223’s picture

That did the trick thank you very much.

Some stuff I just wanted to add for anyone that might need this feature in the future is to also add

http://www.your_site.com/<?php print $picture ?>

as the source for your picture and it will show up looking great!

esmerel’s picture

Status: Active » Closed (fixed)

This looks like it got answered.