After using the user profiles 2 tutorial, I began getting a white screen whenever I edit or save cck content types. I'm not sure, but I think it may have something to do with the alterations to the Kubrick template file. Can you look at this and see if there's a problem that would cause such an error?
<?php
// $Id: template.php,v 1.2.2.2 2007/07/14 11:00:25 Gurpartap Exp $
function kubrick_regions() {
return array(
'header' => t('header'),
'right' => t('right sidebar'),
'content' => t('content'),
'footer' => t('footer')
);
}
function kubrick_primary_links() {
$links = menu_primary_links();
if ($links) {
$output .= '
';
}
return $output;
}
function _phptemplate_variables($hook, $vars) {
if (module_exists('advanced_forum')) {
$vars = advanced_forum_addvars($hook, $vars);
}
if ($hook == 'page') {
if (arg(0) == 'user') {
$vars['tabs'] = str_replace('Edit', 'Edit Account', $vars['tabs']);
}
return $vars;
}
return $vars;
}
// Override the display of the nodeprofile to just show the node itself and not the surrounding markup or the tabs.
// Theming of the nodeprofile will be handled separately. Note that this affects it wherever it is displayed and
// not only on the user page.
function phptemplate_nodeprofile_display_box($element, $content) {
$head = isset($element['#title']) ? '
'. check_plain($element['#title']) .'
' : '';
return $content;
}
// Override the entire user account view page to not show the categories or to seperate items into divs.
// Note that this is set up to still show everything that is thrown on this page. Getting rid of non-nodeprofile
// sections is done in the node_profile_bonus module by unsetting them but could also be done here by conditionally
// printing them to begin with.
function phptemplate_user_profile($account, $fields) {
foreach ($fields as $category => $items) {
foreach ($items as $item) {
$output .= $item['value'] ;
}
}
// Returning nothing from this function causes the entire page to whitescreen, so let's put something in by default
// A better idea might be to load up some sort of standard thing that has the views and just not the profile fields
if (empty($output)) {
$output = "This user has not filled out a user profile.";
}
return $output;
}
function phptemplate_views_view_list_buddylist_of_uid($view, $nodes, $type) {
$fields = _views_get_fields();
$taken = array();
// Set up the fields in nicely named chunks.
foreach ($view->field as $id => $field) {
$field_name = $field['field'];
if (isset($taken[$field_name])) {
$field_name = $field['queryname'];
}
$taken[$field_name] = true;
$field_names[$id] = $field_name;
}
// Set up some variables that won't change.
$base_vars = array(
'view' => $view,
'view_type' => $type,
);
foreach ($nodes as $i => $node) {
$vars = $base_vars;
$vars['node'] = $node;
$vars['count'] = $i;
$vars['stripe'] = $i % 2 ? 'even' : 'odd';
foreach ($view->field as $id => $field) {
$name = $field_names[$id];
$vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
if (isset($field['label'])) {
$vars[$name . '_label'] = $field['label'];
}
}
$items[] = _phptemplate_callback('views-list-buddylist_of_uid', $vars);
}
if ($items) {
return implode(" ",$items);
}
}
// These overrides load custom .tpl files to handle the guestbook display as a whole, a single entry display, and the input form
function phptemplate_guestbook($uid, $entries, $comment_entry, $limit = 20) {
return _phptemplate_callback('guestbook', array('uid'=>$uid, 'entries'=>$entries, 'comment_entry' => $comment_entry, 'limit' => 20));
}
function phptemplate_guestbook_entry($uid, $entry, $comment_entry = NULL, $confirm_delete = false) {
return _phptemplate_callback('guestbook-entry', array('uid'=>$uid, 'entry'=>$entry, 'comment_entry' => NULL, 'confirm_delete' => false));
}
function phptemplate_guestbook_form_entry_form($form) {
return _phptemplate_callback('guestbook-form-entry-form', array('form'=>$form));
}
/**
*
* Insert into your theme's template.php file:
*
* Theme override for user.module
* Utilized imagecache module to scale down large uploaded profile pictures
* @param $size
* Image size to scale to. Options: thumb (default) and large
*/
function phptemplate_user_picture($account, $size = 'thumb') {
if (variable_get('user_pictures', 0)) {
// Display the user's photo if available
if ($account->picture && file_exists($account->picture)) {
$picture = theme('imagecache', $size, $account->picture);
}
return ''.$picture.'';
}
}
There's been a few posts on this before. Try searching for "white" or "wsod". I can't remember offhand what the reasons were anymore. Sorry that's not much of an answer but I really need to focus on advprofile instead of trying to support that old buggy tutorial.
'; foreach ($links as $link) { $link = l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']); $output .= '- ' . $link . '
';
};
$output .= '
'; } return $output; } function _phptemplate_variables($hook, $vars) { if (module_exists('advanced_forum')) { $vars = advanced_forum_addvars($hook, $vars); } if ($hook == 'page') { if (arg(0) == 'user') { $vars['tabs'] = str_replace('Edit', 'Edit Account', $vars['tabs']); } return $vars; } return $vars; } // Override the display of the nodeprofile to just show the node itself and not the surrounding markup or the tabs. // Theming of the nodeprofile will be handled separately. Note that this affects it wherever it is displayed and // not only on the user page. function phptemplate_nodeprofile_display_box($element, $content) { $head = isset($element['#title']) ? ' '. check_plain($element['#title']) .' ' : ''; return $content; } // Override the entire user account view page to not show the categories or to seperate items into divs. // Note that this is set up to still show everything that is thrown on this page. Getting rid of non-nodeprofile // sections is done in the node_profile_bonus module by unsetting them but could also be done here by conditionally // printing them to begin with. function phptemplate_user_profile($account, $fields) { foreach ($fields as $category => $items) { foreach ($items as $item) { $output .= $item['value'] ; } } // Returning nothing from this function causes the entire page to whitescreen, so let's put something in by default // A better idea might be to load up some sort of standard thing that has the views and just not the profile fields if (empty($output)) { $output = "This user has not filled out a user profile."; } return $output; } function phptemplate_views_view_list_buddylist_of_uid($view, $nodes, $type) { $fields = _views_get_fields(); $taken = array(); // Set up the fields in nicely named chunks. foreach ($view->field as $id => $field) { $field_name = $field['field']; if (isset($taken[$field_name])) { $field_name = $field['queryname']; } $taken[$field_name] = true; $field_names[$id] = $field_name; } // Set up some variables that won't change. $base_vars = array( 'view' => $view, 'view_type' => $type, ); foreach ($nodes as $i => $node) { $vars = $base_vars; $vars['node'] = $node; $vars['count'] = $i; $vars['stripe'] = $i % 2 ? 'even' : 'odd'; foreach ($view->field as $id => $field) { $name = $field_names[$id]; $vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view); if (isset($field['label'])) { $vars[$name . '_label'] = $field['label']; } } $items[] = _phptemplate_callback('views-list-buddylist_of_uid', $vars); } if ($items) { return implode(" ",$items); } } // These overrides load custom .tpl files to handle the guestbook display as a whole, a single entry display, and the input form function phptemplate_guestbook($uid, $entries, $comment_entry, $limit = 20) { return _phptemplate_callback('guestbook', array('uid'=>$uid, 'entries'=>$entries, 'comment_entry' => $comment_entry, 'limit' => 20)); } function phptemplate_guestbook_entry($uid, $entry, $comment_entry = NULL, $confirm_delete = false) { return _phptemplate_callback('guestbook-entry', array('uid'=>$uid, 'entry'=>$entry, 'comment_entry' => NULL, 'confirm_delete' => false)); } function phptemplate_guestbook_form_entry_form($form) { return _phptemplate_callback('guestbook-form-entry-form', array('form'=>$form)); } /** * * Insert into your theme's template.php file: * * Theme override for user.module * Utilized imagecache module to scale down large uploaded profile pictures * @param $size * Image size to scale to. Options: thumb (default) and large */ function phptemplate_user_picture($account, $size = 'thumb') { if (variable_get('user_pictures', 0)) { // Display the user's photo if available if ($account->picture && file_exists($account->picture)) { $picture = theme('imagecache', $size, $account->picture); } return ''.$picture.''; } }