Friday, 18. May 2012 - 15:13
The User Interests Module [1] is a module for the fabulous Drupal Web Content Management System [2]. It is a small and simple Module, which shows a user's most used taxonomy terms on the profile page.

Many people customize the user profile layout [3] with a technique described on drupal.org.
In this case too, you may display the user's interests with a simple function call wherever you want, just do
<?php
print theme('user_interests', $user->user_interests);
?>And you also may override the themeable function, by placing it in your template.php. You may modify it as you like.
<?php
function phptemplate_user_interests($items = array(), $title = NULL, $type = 'ul', $attributes = NULL, $limit = 10) {
$i = 0;
$output = '<div class="user-interests">';
if (isset($title)) {
$output .= '<h3>'. $title .'</h3>';
}
if (!empty($items)) {
$output .= "<$type" . drupal_attributes($attributes) . '>';
foreach ($items as $item) {
$i++;
$attributes = array();
$children = array();
if (is_array($item)) {
foreach ($item as $key => $value) {
if ($key == 'data') {
$data = $value;
}
elseif ($key == 'children') {
$children = $value;
}
else {
$attributes[$key] = $value;
}
}
}
else {
$data = $item;
}
if (count($children) > 0) {
$data .= theme_item_list($children, NULL, $type, $attributes); // Render nested list
}
$output .= '<li' . drupal_attributes($attributes) . '>'. $data .'</li>';
if ($i >= $limit) break;
}
$output .= "</$type>";
}
$output .= '</div>';
return $output;
}
?>Weblinks
[1] http://drupal.org/project/user_interests
[2] http://drupal.org
[3] http://drupal.org/node/35728
Post new comment