By gavin_s on
Hello
I am porting to a new theme and my custom user profile does not work. In my old theme I did not have a template.php file so as per the instructions here: http://drupal.org/node/35728 I aded the following code to a new template.php file:
<?php
/**
* Catch the theme_user_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));
}
?>
However my new theme (Barroness) does have a template.php file, so I added the above code to it and am running into problems. No matter where I seem to put thr code it screws up the layout and throws the sidebar beneath the content. Can anyon help? The contents of the existing template.php are below:
<?php
// $Id: template.php,v 1.1.2.2 2007/04/10 00:28:25 jwolf Exp $
// regions for barron
function barron_regions() {
return array(
'sidebar_left' => t('sidebar'),
'content_top' => t('content top'),
'content_bottom' => t('content bottom'),
'footer' => t('footer')
);
}
// sets delimiter and styles for $links
function phptemplate_links($links, $attributes = array('class' => 'links')) {
$output = '';
if (count($links) > 0) {
$num_links = count($links);
$i = 1;
foreach ($links as $key => $link) {
$class = '';
// Automatically add a class to each link and also to each LI
if (isset($link['attributes']) && isset($link['attributes']['class'])) {
$link['attributes']['class'] .= ' ' . $key;
$class = $key;
}
else {
$link['attributes']['class'] = $key;
$class = $key;
}
// Add first and last classes to the list of links to help out themers.
$extra_class = '';
if ($i == 1) {
$extra_class .= 'first ';
} else {
$output .= ' • ';
}
if ($i == $num_links) {
$extra_class .= 'last ';
}
$output .= '<span class="'. $extra_class . $class .'">';
// Is the title HTML?
$html = isset($link['html']) && $link['html'];
// Initialize fragment and query variables.
$link['query'] = isset($link['query']) ? $link['query'] : NULL;
$link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
if (isset($link['href'])) {
$output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
}
else if ($link['title']) {
//Some links are actually not links, but we wrap these in <span> for adding title and class attributes
if (!$html) {
$link['title'] = check_plain($link['title']);
}
$output .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
}
$i++;
$output .= "</span>\n";
}
}
return $output;
}
Comments
Any ideas people? :)
Any ideas people? :)
Fixed it. The issue was in
Fixed it. The issue was in the custom user profile code itself, duh. Other themes didnt worry about it.