By mouse77e on
The code below is my node template for a members profile page. The taxonomy “Community” shows correctly in the teaser view BUT using the same code it does NOT show in the full node.
(In the teaser the taxonomy is labeled as Community but as Business Group in the full node. The labels are in the template as HTML so it does not affect the taxonomy)
Can anyone tell me why this should be?
<?php
print '<STYLE type="text/css">';
print 'H2 {display:none}';
print '</STYLE>';
?>
<?php
// We dont ever want to go to the nodeprofile itself. Always redirect to the user page.
if (arg(0) == "node") {
drupal_goto("user/$node->uid", NULL, NULL, 301);
}
?>
<?php
$namebox=$node->field_first_name[0]['value']." ".$node->field_familyname[0]['value'];
?>
<div class="node<?php print ($sticky) ? " sticky" : ""; ?>">
<div class="nodeheader nodeheader-connect">
<div class="titular"><h4><a href="<?php print $node_url ?>" title="<?php print $namebox ?>"><?php print $namebox ?></h4></a></div>
<div class="content">
<?php if ($node->teaser) { ?>
<?php
// Set up some variables to make the code easier to read without the confusion of which user is which.
$loggedinuser = $GLOBALS['user'];
$profileuser = user_load(array('uid' => $node->uid));
// Split the taxonomy up into one variable per vocabulary
$communities = array();
$hobbies = array();
$reading = array();
$music = array();
$video = array();
$location = array();
foreach ((array)$node->taxonomy as $item) {
switch ($item->vid) {
case 1:
array_push($communities, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 2:
array_push($hobbies, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 3:
array_push($reading, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 4:
array_push($music, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 5:
array_push($video, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 10:
array_push($location, l($item->name, "taxonomy/term/" . $item->tid));
break;
}
}
?>
<div id="user-profile">
<div id="user-basics">
<div class="img-prev-placer"><div class="img-wrapper">
<?php print theme("user_picture",$profileuser); ?>
</div></div>
<!-- Edit -->
<table>
<tr>
<td>
<strong>Community:</strong>
<?php print implode(", ", $communities);?>
</td>
<td><?php print "<strong>Joined:</strong> " . date("F j, Y, g:i a", $profileuser->created) ?></td>
</tr>
<tr>
<td>
<strong>Gender:</strong> <?php print $node->field_gender[0]['value'] ?>
</td>
<td>
<?php
print "<strong>Last Active:</strong> " . date("F j, Y, g:i a", $profileuser->access) ;
if (round((time()-$profileuser->access)/60) < 30) {
print theme_image(path_to_theme() .
"/images/profile/status_online.png", $alt = 'Online', $title = 'Online', $attributes = NULL, $getsize = TRUE);
} else {
print theme_image(path_to_theme() .
"/images/profile/status_offline.png", $alt = 'Offline', $title = 'Offline', $attributes = NULL, $getsize = TRUE);
}
?>
</td>
</tr>
</table>
<!-- end edit -->
</div>
<?php } else { ?>
<?php /********************************** BEGIN FULL NODE CONTENT ************************************/ ?>
<!-- Pull in the panels style sheet -->
<style type="text/css" media="all">@import "/sites/all/modules/panels/layouts/twocol_stacked.css";</style>
<?php
// Set up some variables to make the code easier to read without the confusion of which user is which.
$loggedinuser = $GLOBALS['user'];
$profileuser = user_load(array('uid' => $node->uid));
// Split the taxonomy up into one variable per vocabulary
$communities = array();
$hobbies = array();
$reading = array();
$music = array();
$video = array();
$location = array();
foreach ((array)$node->taxonomy as $item) {
switch ($item->vid) {
case 1:
array_push($communities, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 2:
array_push($hobbies, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 3:
array_push($reading, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 4:
array_push($music, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 5:
array_push($video, l($item->name, "taxonomy/term/" . $item->tid));
break;
case 10:
array_push($location, l($item->name, "taxonomy/term/" . $item->tid));
break;
}
}
?>
<div class="panel-2col-stacked" id='user-profile'>
<!-- TOP PANEL -->
<div class="panel-col-top">
<!-- Print the user's avatar -->
<div class="img-placer"> <div class="img-wrapper"><div class="img-outer"><div class="img-inner">
<?php print theme("user_picture",$profileuser); ?>
</div></div></div></div>
<div class="headerfont">
<?php
if (empty($node->content['field_first_name']['#value'])) {
print "<strong>First Name: </strong><i>Not given</i>";
} else {
print $node->content['field_first_name']['#value'] ;
print $node->content['field_familyname']['#value'] ;
}
?>
<?php print "<strong>Joined:</strong> " . date("F j, Y, g:i a", $profileuser->created) ?>
<br />
<?php
print "<strong>Last Active:</strong> " . date("F j, Y, g:i a", $profileuser->access) ;
if (round((time()-$profileuser->access)/60) < 30) {
print theme_image(path_to_theme() .
"/images/profile/status_online.png", $alt = 'Online', $title = 'Online', $attributes = NULL, $getsize = TRUE);
} else {
print theme_image(path_to_theme() .
"/images/profile/status_offline.png", $alt = 'Offline', $title = 'Offline', $attributes = NULL, $getsize = TRUE);
}
?>
<br /><br />
<!-- enlarging image with Thickbox frame.-->
<a href="/files/pictures/picture-<?php echo $node->uid ;?>.jpg" title="Large user image" class="thickbox">
<img src="/themes/garland/profile/enlarge.png" alt="The BIG picture!" /></a>
<?php
if ($profileuser->uid == $loggedinuser->uid) {
print " ";
} else {
/*if ($profileuser->contact) {
if ($profileuser->uid != 0) {
print l(theme_image(path_to_theme() .
"/images/profile/email.png", $alt = 'Email', $title = 'Email', $attributes = NULL, $getsize = TRUE),
'user/'. $profileuser->uid . '/contact',NULL,NULL,NULL,NULL,TRUE);
}
}*/
if (user_access('access private messages') && (isset($profileuser->privatemsg_allow) ? $profileuser->privatemsg_allow : 1)) {
print l(' ' .theme_image(path_to_theme() .
"/images/profile/user_comment.png", $alt = 'Private Message', $title = 'Private Message', $attributes = NULL, $getsize = TRUE),
'privatemsg/msgto/'. $profileuser->uid,NULL,NULL,NULL,NULL,TRUE);
}
}
?>
<?php
if ($loggedinuser->uid != $profileuser->uid) {
if (@in_array($profileuser->uid, array_keys(buddylist_get_buddies($account->uid))) && user_access('maintain buddy list')) {
print l(' ' .theme_image(path_to_theme() .
"/images/profile/group_delete.png", $alt = 'Remove Buddy', $title = 'Remove Buddy', $attributes = NULL, $getsize = TRUE),
'buddy/delete/'. $profileuser->uid,NULL,NULL,NULL,NULL,TRUE);
} else {
if ($profileuser->uid != $account->uid && user_access('maintain buddy list')) {
print l(' ' .theme_image(path_to_theme() .
"/images/profile/group_add.png", $alt = 'Add to buddy list', $title = 'Add to buddy list', $attributes = NULL, $getsize = TRUE),
'buddy/add/'. $profileuser->uid,NULL,NULL,NULL,NULL,TRUE);
}
}
}
?>
</div>
</div>
<div class="field field-type-text field-field-about-me">
<div class="titular"><h4>My Time with the Mouse:</h4></div>
<div class="field-items">
<?php foreach ((array)$field_about_me as $item) { ?>
<div class="field-item"><p><?php print $item['view'] ?></p></div>
<?php } ?>
</div>
<!-- LEFT PANEL -->
<div class="panel-col-first">
<div class="titular"><h4>Where I worked:</h4></div>
<p><strong>Business Group:</strong></p>
<p><?php print implode("<br /> ", $communities);?></p>
<br />
<p><strong>Work Locations:</strong></p>
<p><?php print implode("<br /> ", $location);?></p>
<div id="user-tracker">
<div class="titular"><h4>My Recent Forum Posts:</h4></div>
<?php
$view = views_get_view('user_tracker');
print views_build_view('embed', $view, array(strval($profileuser->uid)), false, $view->nodes_per_page);
?>
</div>
</div>
<!-- RIGHT PANEL -->
<div class="panel-col-last">
<div id="user-stats">
<div class="titular"><h4>About Me:</h4></div>
<?php
if (is_array($node->content['group_stats'])) {
foreach ($node->content['group_stats'] as $key => $value) {
if (is_array($value)) {
if (array_key_exists('#value', $value)) {
print $value['#value'] ;
}
}
}
}
?>
</div>
<div id="user-interests">
<div class="titular"><h4>My interests:</h4></div>
<?php
print $node->content['field_interests']['#value'];
if (!empty($hobbies)) {
print '<strong>Hobbies:</strong> ' . implode(", ", $hobbies) . '<br />';
}
if (!empty($reading)) {
print '<strong>Reading:</strong> ' . implode(", ", $reading) . '<br />';
}
if (!empty($music)) {
print '<strong>Music:</strong> ' . implode(", ", $music) . '<br />';
}
if (!empty($video)) {
print '<strong>TV & Movies:</strong> ' . implode(", ", $video) . '<br />';
}
?>
</div>
<div id="user-links">
<div class="titular"><h4>Other places I hang out:</h4></div>
<?php
if (is_array($node->content['group_links'])) {
foreach ($node->content['group_links'] as $key => $value) {
if (is_array($value)) {
if (array_key_exists('#value', $value)) {
print $value['#value'] ;
}
}
}
}
?>
</div>
<div id="user-buddies">
<div class="titular"><h4>My buddies:</h4></div>
<?php
$view = views_get_view('buddylist_of_uid');
print views_build_view('embed', $view, array(strval($profileuser->uid)), false, false);
?>
</div>
</div>
</div>
<!-- BOTTOM PANEL -->
<div class="panel-col-bottom">
<!--Gallery -->
<div id="user-gallery">
<div id="user-guestbook">
<div class="titular"><h4>My Photos:</h4></div>
</div>
<?php
$view = views_get_view('photo_user');
print views_build_view('embed', $view, array(strval($profileuser->uid)), false, false);
?>
</div>
<!--div id="user-guestbook">
<div class="xsnazzy">
<b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b><b class="xb5"></b><b class="xb6"></b><b class="xb7"></b>
<div class="xboxcontent">
<div class="titular">Guestbook</div>
</div>
<b class="xb7"></b><b class="xb6"></b><b class="xb5"></b><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b>
</div>
<?php
if (module_exists('guestbook')) {
if(!$profileuser->guestbook_status){ // guestbook_status seems to store 0 for enabled and 1 for disabled
print module_invoke('guestbook', 'page', $profileuser->uid);
}
}
?>
</div>
</div>
<br class="panel-clearer" />
</div-->
<?php } ?>
</div>
<div class="nodefooter nodefooter-connect">
</div>
</div>
<?php if ($links): ?>
<div class="links"><?php print $links; ?></div>
<?php endif; ?>
</div>