Because i need this too, i have rewritten it.
In addition you can use Lightbox2 or Thickbox for displaying the full user picture.
You have to choose the presets under :
/admin/settings/profile_imagecache
blocks don't load the node, hence the arg and nid approach. this will do what you want, but only works in Drupal 6.
parent method will work, but only two levels deep. you'll have to add a bit more logic if you want it to work with children of children.
<?php
if (arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1);
$node = node_load(array('nid' => $nid));
if ($node->book['bid']==41) {
return TRUE;
}
else {
return FALSE;
}
}
?>hook_content_extra_fields(), and in this article we'll show you how to use it.hook_content_extra_fields(), and in this article we'll show you how to use it.I just realized I had the same problem in my D6 site and I figured out a solution using the Theme Information in my theme.
I copied the code for views-view-fields.tpl.php and added an if statement to check for the existence of $field->content, namely:
<?php if ($field->content): ?>
<?php if ($field->label): ?>
<label class="views-label-<?php print $field->class; ?>">
<?php print $field->label; ?>:
</label>
<?php endif; ?>
<?php endif; ?>Seems to work fine. I'd like to hear of better/different options.
From the early days, Drupal had the ability to embed PHP code in its content. This provides flexibility and functionality, most importantly, nodes and blocks can contain dynamically fetched data from the database using custom queries and displayed them in other content.
This is an easy approach to get such data without writing a module. All you need to do is assign the PHP input format filter to the node or block and paste your PHP code in it, and voila, you have dynamic content.
However, this approach is suboptimal and has serious drawbacks, including:
Though one would think the $field object is what we wanted-- the actual object we needed is $row (even though we're only looking at one field in the row).
Put the following into the field tpl file to see what the necessary info is:
<?php
print '<pre>';
print_r($row);
print '</pre>';
?>Then, to actually make the link, put the following in your field tpl file:
<?php
$account = user_load($row->uid);
print l($row->profile_values_profile_fullname_value, 'users/' . $account->name);
?>Change 'profile_values_profile_fullname_value' to the proper field alias (based on the $row output). Also, be sure to change 'users' to whatever the path is for your user accounts.
I also had another thought-- given your use case, you may want to consider the http://drupal.org/project/realname module as well. It will replace usernames with whatever field(s) you designate all over the site.
EDIT: I had another thought. I'm not sure of the performance implications of doing a user_load in the template file. Another option is to add the 'User: name' field to the view but exclude it from display. Then you could avoid the user_load and change the code in the tpl file to:
<?php
print l($row->profile_values_profile_fullname_value, 'users/' . $row->users_name);
?>6.x version in the comments
Because i need this too, i have rewritten it.
In addition you can use Lightbox2 or Thickbox for displaying the full user picture.
You have to choose the presets under :
/admin/settings/profile_imagecache
drupal_problems_solved (9)
drupal_views2 (6)
drupal_og (5)
drupal_theme (4)
drupal6 (3)
drupal_forms (3)
drupal_modules (3)
drupal_block (2)
drupal_views (2)
drupal_user_forms (2)
drupal_panels (2)
drupal_cck (2)
drupal_features (1)
drupal_install_profiles (1)
htaccess (1)
drupal_usability (1)
drupal_best_modules (1)
p_peb3 (1)Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »
Join Diigo