I was tinkering with my profile_listing.tpl.php file, as per this page, and was quite satisfied with the outcome, so I thougth I'd share this with you...

The resulting page is here.

profile_listing.tpl.php code is:

<?php profile_load_profile($user->uid) ?>

<?php 
if ( $GLOBALS['user']->uid == $user->uid ) {
        $thisiscurrentuser=TRUE;
} else {
        $thisiscurrentuser=FALSE;
}


if ( $user->picture ) {
	$currentpicture=$user->picture;
} else {

	if ($thisiscurrentuser){
		$currentpicture="files/images/add_photo.png";
		$photoneedsupdating=TRUE;
	} else {

		$currentpicture="files/images/no_photo.png";
	}
}
?>


<?php if ($photoneedsupdating) print "<a href=\"user/$user->uid/edit\">" ?>
<img class="<?php print $zebra ?>" src="/<?php print $currentpicture ?>">
<?php if ($photoneedsupdating) print "</a>" ?>


<?php
  $band_name=$user->name;
  if($user->profile_name){
  $band_name=$user->profile_name;
   } 
?>
<h2><?php print $band_name ?></h2>

<a href="/user/<?php print $user->uid ?>"><?php print $band_name ?>'s profile</a>

<?php if($user->profile_website): ?>
<br><a class="external" href="<?php print $user->profile_website ?>"><?php print $band_name ?>'s homepage</a>
<?php endif; ?>

<br clear=all>
<hr>

and the CSS now includes:

img.odd{
        float: right;
}


img.even{
        float: left;
        padding-right: 10px;
}

The no_photo.png file is a default 'This person has no photo' type thing.
The add_photo.png file says 'Click here to add your photo.'

I'm not really big into PHP, so if there's any glaring error in my code, do let me know.

I hope someone can make use of some of this.

Rob

Comments

hectorplus’s picture

Its gonna come in handy sometime for me.

Tecito.com
Comunidad Latina en Canada, regístrate ya! Join the growing latin community in Canada.

Southpaw’s picture

Thanks for the tip! I might use this in the future depending on how things go!

enky’s picture

good tip, thanks a lot,