User login

Taxonomy

Exclude the results of a one-node view from another view (the Featured Feature problem)

Drupal 6 Views 2 has an offset modifier to the "Items to display" property which should make doing this dead simple; just create two displays of the same view with different settings for these two options.

Scroll way down for the resolution in Drupal 5:

Hat tip to:
http://drupal.org/node/131482

dan hak 3:45
featured view shows latest feature only
other one shows everything
all featured are in the everything vocab too

Drupal new taxonomy terms not appearing as option for old content

Did you add a taxonomy term to a vocabulary and it's just not showing up on existing content, contrary to all known laws of Drupal taxonomy?

Are you also using localization (l10n) / internationalization (i18n) such that your vocabularies and (even if you don't know it) terms can declare a language?

Check the language of that term. It will rudely default to the default language of the user you are using to add the term, even if the vocabulary overall declares itself to be neutral (blank) with respect to language.

Taxonomy_term_count_nodes gives stupid results when child terms have same nodes

The Drupal core function in taxonomy.module, taxonomy_term_count_nodes, has no check in it to remove duplicate nodes, which can happen in situations where a nodde belongs to both a child and a parent. In my opinion there should be a different function taxonomy_term_and_children_count_nodes or a flag in the function to say if nodes belonging to children terms should be counted at all, and if they are, there should be proper checking to remove duplicates.

Copy (or inherit) taxonomy terms from one node to another

function wsf_action_copy_terms($from_nid, $to_nid, $avoid_race = FALSE) {
// agaric-ben @TODO optimize;
// see http://agaricdesign.com/note/copy-taxonomy-terms-from-one-node-another
  if ($avoid_race) {
    // avoid pseudo race condition from taxonomy_node_get_terms static variable

White Screen of Death due to taxonomy parent-child infinite loop

The site stopped showing. Nothing.

What I should have done first:

tail -f /var/log/apache2/error.log

0 stedile:~# apache2ctl restart

0 stedile:~# /etc/init.d/mysql restart

Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld . . . . ..
Checking for corrupt, not cleanly closed and upgrade needing tables..

0 stedile:~# xm console stedile
-bash: xm: command not found

Avoiding loopy merges when cleaning up Place vocabularies with Taxonomy Manager

The key to preventing infinite loops in a Place vocabulary, which can be introduced while cleaning it up via Taxonomy Manager, is not to assume that just because something has the name of a country that it is a country.

Users have on occasion mistakenly put a town name in the country field and a country in the town field.

Now, I had already adapted taxonomy manager (via form_alter, without touching the its code, we did it the Drupal way!) to show this information provided by the Place module.

Delete unused taxonomy terms from a free tagging vocabulary

Wish taxonomy terms would get deleted when a node is deleted, if they aren't used by any other content?

Agaric brings you the next best thing.

@TODO ben-agaric: turn this into a module

Basically we want to delete any term that doesn't exist in the term_node table, though it would be nice to do this by vocabulary (as in, nice not to accidentally delete your carefully set up non-free tagging vocabulary)

Can't use taxonomy_node_get_terms immediately after terms inserted

The short version is in the title -- use your own query (or the get terms by vocab one which doesn't use a cache technique of any sort, no static variable).

The rest of the post is how NOT to do it when you're pressed for time and making stupid time-consuming mistakes.

let's transfer places

Action made in the same turn (but definitely after) an Action space (organic group) does this:

Getting latitude and longitude for countries, provinces, or cities

Stolen from Dwees in this comment:

  $city = $node->location['city'];
  $province = $node->location['province'];
  $country = $node->location['country'];

  $address = str_replace(" ", "+", $city .",". $province .",". $country);
  $google_key = variable_get('googlemap_api_key', '');

Syndicate content