A basic User Profile Page to help get you started
PLEASE NOTE! These snippets are user submitted. It is impossible to check them all, so please use at your own risk! For users who have setup Drupal using a database other than MySQL note that the snippets may contain some database queries specific to MYSQL.
Description
This php snippet displays is a basic user_profile.tpl.php file to help get you started.
Dependencies: Requires the profile.module to be enabled and city, country custom single-line profile fields added.
Usage
- Using a text editor copy and paste the code into user_profile.tpl.php file
- Change the custom profile field names to match the specific site. (Tip: go to administer -->> settings -->> profile and in the second column it will show the name of each field.)
- Change the div class names or the prefix text to suit.
<div class="custom_profiles">
<div class="fields"><?php print $user->name ?></div>
<div class="fields">City: <?php print $user->profile_city ?></div>
<div class="fields">Country: <?php print $user->profile_country ?></div>
<div class="fields">Postcode: <?php print $user->profile_postcode ?></div>
</div>A starter template that reproduces a D5 profile
<div class="profile">
<?php if($user->picture) {print theme('user_picture', $user);} ?>
<?php
foreach ($fields as $category => $items) {
if (strlen($category) > 0) { ?>
<h2 class="title"> <?php print (check_plain($category)); ?> </h2>
<?php } ?>
<dl>
<?php
foreach ($items as $item) {
if (isset($item['title'])) { ?>
<dt class="<?php print ($item['class'].'">'. $item['title']); ?> </dt>
<?php } ?>
<dd class="<?php print ( $item['class'] .'">'. $item['value']); ?></dd>
<?php } ?>
</dl>
<?php } ?>
Auto-configure a profile.
For auto-configuration of a dozen common 'profile' fields, you may want to try vcard.module which now as a bonus has one-click creation of a default user profile definition with standard attribute names.
It's a handy shortcut. If you don't want vcard, you can disable it and remove after it's done the creation.
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/