Hello.

I am making modifcations to my user list page. Not the profiles themselves, but the listing. For some reason I cannot find a way to make the users username be a link to their profile page.

Here is a copy of my customized profile_listing.tpl

<table width="90%" border="0" cellspacing="0" cellpadding="0">




<tr>

    <td><?php print $user->name ?></td>

    <td><?php print $user->profile_firstname ?></td>

    <td>

	<?php

    $year_diff = date("Y") - ($user->profile_bday{year});

    $month_diff = date("m") - ($user->profile_bday{month});

    $day_diff = date("d") - ($user->profile_bday{day});

    if ($month_diff < 0)

      $year_diff--;

    elseif ($month_diff == 0 && $day_diff < 0)

      $year_diff--; 

	  ?>

	</td>

    <td><?php print $user->profile_city ?></td>

    <td><?php print $user->profile_orientation ?></td>

    <td><?php print $user->profile_status ?></td>

    <td>

	<?php if($user->picture): ?>

	<img src="/<?php print $user->picture ?>">

	<?php endif; ?>

	</td>

  </tr>



</table>

Comments

Kuldip Gohil’s picture

global $base_url;
global $user;
l( $user->name,'$base_url/$user->uid'); /*put associated link */ print $user->profile_firstname

    $year_diff = date("Y") - ($user->profile_bday{year});

    $month_diff = date("m") - ($user->profile_bday{month});

    $day_diff = date("d") - ($user->profile_bday{day});

    if ($month_diff < 0)

      $year_diff--;

    elseif ($month_diff == 0 && $day_diff < 0)

      $year_diff--;

      
print $user->profile_city print $user->profile_orientation print $user->profile_status

if($user->picture):

Only local images are allowed. print $user->picture ">

endif;

Hi I have not tested this code but it should be like this

mskristinahall’s picture

I am going to try that right now!

mskristinahall’s picture

I copied the code you gave me just to see what it would do.

It displays this http://kristinahall.net/qwo/?q=profile

Scott Reynolds’s picture

This seems like a silly question but hmm I guessing its the right answer...

did you turn on users ability to access user profiles in admin/user/access?

to fix the code...

table width="90%" border="0" cellspacing="0" cellpadding="0">




<tr>
    <td><?php print l($user->name, 'user/' . $user->uid); ?></td>

    <td><?php print $user->profile_firstname ?></td>

    <td>

<?php

    $year_diff = date("Y") - ($user->profile_bday{year});

    $month_diff = date("m") - ($user->profile_bday{month});

    $day_diff = date("d") - ($user->profile_bday{day});

    if ($month_diff < 0)

      $year_diff--;

    elseif ($month_diff == 0 && $day_diff < 0)

      $year_diff--;

      ?>

</td>

    <td><?php print $user->profile_city ?></td>

    <td><?php print $user->profile_orientation ?></td>

    <td><?php print $user->profile_status ?></td>

    <td>

<?php if($user->picture): ?>

<img src="/<?php print $user->picture ?>">

<?php endif; ?>

</td>

  </tr>



</table>

see: http://api.drupal.org/api/function/l/5

mskristinahall’s picture

Aha! Yay thank you. It works fine now :D