/[drupal]/contributions/modules/user_tags/user_tags.module
ViewVC logotype

Diff of /contributions/modules/user_tags/user_tags.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.8.2.2, Tue May 6 17:35:27 2008 UTC revision 1.8.2.3, Tue May 6 18:57:03 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: user_tags.module,v 1.8.2.2 2008/05/06 17:35:27 deekayen Exp $
3    
4  /**  /**
5   * Implementation of hook_help().   * Implementation of hook_help().
# Line 16  function user_tags_help($section) { Line 16  function user_tags_help($section) {
16   * Implementation of hook_perm().   * Implementation of hook_perm().
17   */   */
18  function user_tags_perm() {  function user_tags_perm() {
19    return array('tag users');    return array('tag users', 'view user tags');
20  }  }
21    
22  function user_tags_menu($may_cache) {  function user_tags_menu($may_cache) {
# Line 48  function user_tags_settings() { Line 48  function user_tags_settings() {
48      while ($vocab_list = db_fetch_object($vocab)) {      while ($vocab_list = db_fetch_object($vocab)) {
49        $options[$vocab_list->vid] = $vocab_list->name;        $options[$vocab_list->vid] = $vocab_list->name;
50        if ($vocab_list->description) {        if ($vocab_list->description) {
51          $options[$vocab_list->vid] .= " - ". $vocab_list->description;          $options[$vocab_list->vid] .= ' - '. $vocab_list->description;
52        }        }
53      }      }
54      $enabled_vocab = db_query("SELECT vu.vid, v.name FROM {user_tags_vocabulary} vu INNER JOIN {vocabulary} v ON v.vid = vu.vid");      $enabled_vocab = db_query("SELECT vu.vid, v.name FROM {user_tags_vocabulary} vu INNER JOIN {vocabulary} v ON v.vid = vu.vid");
# Line 78  function user_tags_settings() { Line 78  function user_tags_settings() {
78        "#return_value" => true,        "#return_value" => true,
79      );      );
80    
81    } else {    }
82      else {
83      drupal_set_message(t('You must add a !link before using this module.', array('!link' => l(t('vocabulary'), 'admin/taxonomy'))), "error");      drupal_set_message(t('You must add a !link before using this module.', array('!link' => l(t('vocabulary'), 'admin/taxonomy'))), "error");
84    }    }
85    
86    return $form;    return $form;
87  }  }
88    
89    /**
90     * Implementation of hook_user().
91     */
92  function user_tags_user($op, &$edit, &$account, $category = NULL) {  function user_tags_user($op, &$edit, &$account, $category = NULL) {
93    switch ($op) {    switch ($op) {
94      case 'view':      case 'view':
95        $list = array();        if (user_access('view user tags')) {
96        foreach ($account->taxonomy as $tid => $term) {          $list = array();
97          $list[] = array('value' => l($term->name, "tag/user/$tid"));          foreach ($account->taxonomy as $tid => $term) {
98        }            $list[] = array('value' => l($term->name, "tag/user/$tid"));
99        if (!empty($list)) {          }
100          return array('Tags' => $list);          if (!empty($list)) {
101              return array('Tags' => $list);
102            }
103        }        }
104        break;        break;
105    

Legend:
Removed from v.1.8.2.2  
changed lines
  Added in v.1.8.2.3

  ViewVC Help
Powered by ViewVC 1.1.2