Questo scritto, inserito in un blocco PHP che appare sulla pagina del profilo utente permette di visualizzare in anteprima le immagini da egli inserite. Lo riporto da drupal.org e funziona.
<?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));
}
?>
<?php
// Display N most recent thumbnails of images submitted by the user
// Each thumbnail is linked back to it's image node
// Can optional limit the photos shown by specififying one or taxonomy term id's
// The number of thumbnail images to show
$nlimit = 30;
$taxo_id = array();
// Add one line for each taxonomy term id you want to limit the thumbnails to
// As an example, the following two lines would select images associated with taxonomy terms 36 OR 37
// $taxo_id[] = 36;
// $taxo_id[] = 37;
// Note, if not taxonomy term ids are specified, the selection is from all the user submitted images
$userid=arg(1);
if ( count($taxo_id) > 0 ) {
// Limit images based on taxonomy term id's
$taxo_str = implode(',', $taxo_id);
$sql = "SELECT n.created, n.title, n.nid, n.changed FROM node n INNER JOIN term_node ON n.nid = term_node.nid AND term_node.tid IN ($taxo_str) WHERE n.type = 'image' AND n.uid = $userid AND n.status = 1 ORDER BY n.changed DESC";
}
else {
$sql = "SELECT n.created, n.title, n.nid, n.changed FROM node n WHERE n.type = 'image' AND n.uid = $userid AND n.status = 1 ORDER BY n.changed DESC";
}
$result = db_query_range($sql, 0, $nlimit);
$output = '';
while ( $info = db_fetch_object($result) ) {
$node = node_load(array('nid' => $info->nid));
$img_tag = image_display($node, 'thumbnail');
$link = 'node/' . $node->nid;
$output .= l($img_tag, $link, array(), NULL, NULL, FALSE, TRUE);
}
print $output;
?>