Index: user_terms.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/user_terms/user_terms.install,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 user_terms.install
--- user_terms.install	22 Jun 2010 22:34:37 -0000	1.1.2.4
+++ user_terms.install	20 Jul 2010 08:40:21 -0000
@@ -64,6 +64,7 @@ function user_terms_uninstall() {
   variable_del('user_terms_group_title');
   variable_del('user_terms_vocabs_register');
   variable_del('user_terms_vocabs_path');
+  variable_del('user_terms_block_config');
 }
 
 
Index: user_terms.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/user_terms/user_terms.module,v
retrieving revision 1.1.2.30
diff -u -p -r1.1.2.30 user_terms.module
--- user_terms.module	8 Jul 2010 20:09:54 -0000	1.1.2.30
+++ user_terms.module	20 Jul 2010 08:40:22 -0000
@@ -68,6 +68,11 @@ function user_terms_user($op, &$edit, &$
     // The module should format its custom additions for display, 
     // and add them to the $account->content array.
     case 'view':
+      $config = variable_get('user_terms_block_config', array());
+      if (!isset($config['hide_in_profile'])) {
+        $config['hide_in_profile'] = FALSE;
+      }
+      if ($config['hide_in_profile']) return array();
       return user_terms_view_profile($account);
 
     // The user account edit form is about to be displayed.
@@ -89,6 +94,69 @@ function user_terms_user($op, &$edit, &$
   }
 }
 
+/**
+ * Implementation of hook_block().
+ */
+function user_terms_block($op = 'list', $delta = 0, $edit = array()) {
+  $config = variable_get('user_terms_block_config', array());
+  if (!isset($config['hide_in_profile'])) {
+    $config['hide_in_profile'] = FALSE;
+  }
+  if (!isset($config['uid_regex'])) {
+    $config['uid_regex'] = '|^user/(?P<uid>[0-9]+)(/.*)?$|';
+  }
+  switch ($op) {
+  case 'list':
+    return array(
+      'user_terms_list' => array(
+        'info' => t("List of user's terms"),
+        'cache' => BLOCK_NO_CACHE,
+      )
+    );
+  case 'configure':
+    $form = array();
+    $form['uid_regex'] = array(
+      '#type' => 'textfield',
+      '#title' => t("PHP regex to retrieve UID from page's address (use 'uid' group to mark uid)"),
+      '#description' =>
+        t('For example: %example regex accepts pages like user/%uid and user/%uid/*',
+          array('%example' => '|^user/(?P<uid>[0-9]+)(/.*)?$|'
+        )),
+      '#default_value' => $config['uid_regex'],
+    );
+    $form['hide_in_profile'] = array(
+      '#type' => 'checkbox',
+      '#title' => t("Hide user's terms in profile"),
+      '#default_value' => $config['hide_in_profile'],
+    );
+    return $form;
+  case 'save':
+    $config = array(
+      'uid_regex' => $edit['uid_regex'],
+      'hide_in_profile' => !!$edit['hide_in_profile'],
+    );
+    variable_set('user_terms_block_config', $config);
+  case 'view':
+    $dest = explode("=", drupal_get_destination());
+    unset($dest[0]); $dest = urldecode(implode("=", $dest));
+    $ms = array();
+    if (preg_match_all($config['uid_regex'], $dest, $ms) != 1) {
+      return array();
+    }
+    $uid = $ms['uid'][0];
+    if (!is_numeric($uid)) return array();
+    
+    $uid = (int)$uid;
+    $acc = user_load($uid);
+    user_build_content($acc);
+    user_terms_view_profile($acc); // We need to call it manually, if hide_in_profile option is used
+    unset($acc->content['user_terms']['#title']);
+    return array(
+      'subject' => t("User's terms"),
+      'content' => drupal_render($acc->content['user_terms']),
+    );
+  }
+}
 
 /**
  * Load the user's profile.
