Luckily this is only on my test server, but my custom user_profile.tpl.php is causing major problems with the login. I have front_page.module installed, and when the users click a link on the front page, they get taken to a login screen. They log in, and it is supposed to take them right to their profiles (site.com/user). However, they log in, and it takes them to a blank page, and when they refresh the page, it logs them out and they go through the process again. I opened template.php and took out the code that leads to the custom profile, and logins work now. What is the matter with my code? All the code in my templates was gained directly from this site, in the handbook section.
template.php:
<?php
/**
* Catch the theme_profile_profile function, and redirect through the template api
*/
function phptemplate_user_profile($user, $fields = array()) {
// Pass to phptemplate, including translating the parameters to an associative array. The element names are the names that the variables
// will be assigned within your template.
/* potential need for other code to extract field info */
return _phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields));
}
?>user_profile.tpl.php:
<?php if($user->picture): ?>
<div class="picture">
<img src="/<?php print $user->picture ?>">
</div>
<?php endif; ?>
<div class="fields">
<p>Member for: <?php print (format_interval(time() - $user->created));?></p>
</div>
<div class="custom_profiles">
<div class="fields"><b>Name:</b> <?php print check_plain($user->profile_name) ?></div>
<div class="fields"><b>Email Address:</b> <?php print check_plain($user->profile_public_email ) ?></div>
<div class="fields"><b>Gender:</b> <?php print check_plain($user->profile_gender) ?></div>
<div class="fields"><b>Birthday:</b> <?php
print $user->profile_birthday['month']."/".$user->profile_birthday['day']."/".$user->profile_birthday['year'];
?>
</div>
<div class="fields"><b>Personal Website:</b> <?php print check_markup($user->profile_web) ?></div>
<div class="fields"><b>Schooling:</b> <?php print check_markup($user->profile_school) ?></div>
</div>
<div class="fields"><b>IM Screenname:</b> <?php print check_markup($user->profile_aim) ?></div>
<div class="fields"><b>About Me:</b> <?php print check_markup($user->profile_about) ?></div>
<div class="fields"><b>Interests:</b> <?php print check_markup($user->profile_interests) ?></div>
<div class="fields"><b>Musical Tastes:</b> <?php print check_markup($user->profile_music) ?></div>
<div class="fields"><b>If I could conquer the world...:</b> <?php print check_markup($user->profile_conquer) ?></div>
<p> <p>
<b>Latest blog posts:
<?php $nlimit = 10; ?>
<?php $userid=$user->uid; ?>
<?php $result = db_query("SELECT n.created, n.title, n.nid, n.changed FROM node n WHERE n.uid = $userid AND n.type = 'blog' AND n.status = 1 ORDER BY n.changed DESC LIMIT $nlimit"); ?>
<?php $output .= "<div class=\"item-list\"><ul>\n"; ?>
<?php $output .= node_title_list($result); ?>
<?php $output .= "</ul></div>"; ?>
<?php print $output; ?>
<p> <p>
<?php
/* if you want to change which category you grab just change the following line */
$i_want_all_fields_under_this_category = 'Buddy List';
$output = '';
foreach ($fields as $category => $items) {
if($category == $i_want_all_fields_under_this_category) {
$output .= '<h2 class="title">'. $category .'</h2>';
$output .= '<dl>';
foreach ($items as $item) {
/*for control over which 'titles' you grab you can insert another conditional if-statement here */
if (isset($item['title'])) {
$output .= '<dt class="'. $item['class'] .'">'. $item['title'] .'</dt>';
}
$output .= '<dd class="'. $item['class'] .'">'. $item['value'] .'</dd>';
}
$output .= '</dl>';
}
}
print $output;
?>
<p> <p>
<div class="fields">
<?php print l('Send a private message to '.$user->name, 'privatemsg/msgto/'. $user->uid); ?>
</div>
<p> <p>
<div class="fields">
<p><?php print t('Userpoints: ').db_result(db_query('SELECT points FROM {userpoints} WHERE uid = %d', $user->uid));?></p>
</div>
Comments
Aww come on, I saw someone
Aww come on, I saw someone getting help on something completely unrelated, yet no one responds to a legitmate problem?