| 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(). |
| 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) { |
| 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"); |
| 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 |
|
|