Let me first take a moment to thank the creators and maintainers of this module. This is A-class material... Thank you guys for your diligence and art.

-----

My feature request is potentially a quick one. I need to mask the My Tags component. So basically I want "All Tags" and then the inline tag adder to work, without displaying the user's past tags for the node. In place of "My Tags" perhaps I could show simple instructions for adding tags below...

I think this is a matter of commenting out code in community_tags.pages.inc? Any advice is much appreciated.

Comments

chaps2’s picture

Priority: Major » Normal

This seems like an odd requirement to me and I'm intrigued as to why you want to do this?

The easiest way to do this is to use CSS to hide the My Tags list e.g. add this to your theme's CSS:

div.tag-widget ul.inline-tags {
  display: none;
}

You may want to play around a bit with other CSS settings to get the right spacing etc.

Doing it this way, the user will not see their previous tags in the textfield.

The other approach would be to disable the Javascript that creates the My Tags list from the tags listed in the textfield. This way the user will see their previous tags in the textfield and the Add button operates more obviously as an Update button. Do you want AJAX update of user's tags?

andrew7’s picture

You are right. This is a bit of a strange workaround for my end goal (below). Perhaps there's an easier way to accomplish the following:

I am trying to display of all the weighted community tags for the node, right under the node title.

The community tagging form is on a block to the side and it's functioning perfectly. On the main node content display area though I get a list of flat community tags though - not weighted ones.

I just need to show all the weighted community tags (of 2 vocabularies) on the main node display page.

chaps2’s picture

You can do this with theming. Try putting the following in your theme's template.php file.

/**
 * Preprocess node.
 */
function phptemplate_preprocess_node(&$vars) {
  // add community tag cloud to node pages
  if ($vars['page']) {
    // get the tag cloud for this node and for all vocabularies (no 4th argument)
    $cloud = _community_tags_display_handler_tagadelic('node', NULL, $vars['nid']);
    // preprend to the node content
    $vars['content'] = $cloud . $vars['content'];
    // unset terms variable to prevent the usual list of term links
    unset($vars['terms']);
  }
}

If you need to you can test the node type ($vars['type']) to only display the cloud on relevant pages.

Even better would be to add the rendered cloud to the $vars array:

$vars['cloud'] = _community_tags_display_handler_tagadelic('node', NULL, $vars['nid']);

And then edit your theme's node.tpl.php (or if your theme doesn't have one create one based on modules/node/node.tpl.php). It should be obvious what to do to display the cloud wherever you need it.

You say you want to display community tags from two vocabularies - have you got two tagging forms in the block - one for each vocabulary?

andrew7’s picture

Brilliant! This works beautifully, thank you.

Yes, I have 2 vocabularies... After adding your code, a mixed tagedelic list of both vocabularies shows up, which is exactly what I need.

1. Alternatively, if I were to add the rendered cloud to the $vars array, wouldn't that be a performance drain, given that only one content type on the site is using tags clouds? The way I've done it now is to add your function to template.php, and just check to make sure that the content type being displayed needs the tag cloud... Just for other readers' reference, this was done by changing line 7 from chaps2's code to the following:

<?php>
  if ($vars['page'] && $vars['type']=='person') {
<?>

... where 'person' is the content type of the node that needs the tag cloud.

2. Given that the tag cloud is displaying properly, can I remove the "All Tags" from the Community Tag block? And is it possible to tweak the "My Tags" label? Would this be done in community_tags.pages.inc?

chaps2’s picture

1. No, it wouldn't be a performance drain. It's just a better way to do it and gives you much more theming flexibility. What I am suggesting is that the preprocess function looks like this:

/**
 * Preprocess node.
 */
function phptemplate_preprocess_node(&$vars) {
  // add community tag cloud to node pages
  if ($vars['page'] && $var['type'] == 'person') {
    // get the tag cloud for this node and for all vocabularies (no 4th argument)
    $vars['cloud'] = _community_tags_display_handler_tagadelic('node', NULL, $vars['nid']);
    // unset terms variable to prevent the usual list of term links
    unset($vars['terms']);
  }
}

And then add the following to node.tpl.php or a content type specific template of node-person.tpl.php wherever you need it:


  <?php if ($cloud): ?>
    <?php print $cloud; ?>
  <?php endif; ?>

2) The easiest way to tweak "My tags" is to use the string override feature in Drupal. To the bottom of your settings.php file add:

$conf['locale_custom_strings_en'] = array(
  'My tags'      => "Your tags",
  'My !name tags'      => "Your !name tags", // where !name is the vocabulary name
);

Alternatively you could implement a form alter hook which would give you a few more options...

But whatever you do, try to resist the temptation to tweak core and or contrib module files otherwise you'll end up wishing you hadn't!

chaps2’s picture

Status: Active » Closed (won't fix)