Hello,

I'm having trouble building a custom user theme page that lists a user's recent blogs with snippets.
I have a views page set up and ready for a user name argument, but I cannot get a username variable for the current profile page no matter what I try.

<div class="profile">
  <?php print $user_profile; ?>
  <?php print views_embed_view('viewBlogs', 'Page', $user->name ); ?>

  <?php echo "Name: $user->name<br>"; ?>
</div>

This code displays the current user's username, but not the profile's username. I can't seem to find any documentation on Profile variables and I'm afraid I'm going to have to use a substring search method to extract the username from the meager $profile array's fields.

Any suggestions welcome.

Comments

nevets’s picture

You can add

<pre>
<?php print print_r($user, TRUE); ?>
</pre>

to see all the available fields.

carlthuringer’s picture

Thanks, but this doesn't show the fields avaliable to the profile page.

I need to get the username of the PROFILE being displayed, not the currently logged-in user.

nevets’s picture

A change from Drupal 5, the default file says to do

<?php print '<pre>'. check_plain(print_r($profile, 1)) .'</pre>'; ?>

to see all the available unformatted data.

carlthuringer’s picture

Yes, I've done that too, but it only appears to have two items in the array. Neither of them is the username of the profile, it's mostly a bunch of HTML code.

doctorflix’s picture

i.e. $account->name

-the doctor
http://www.doctorflix.com