In D7 when I enter any title for a taxonomy term and click Save, I get the following errors:

    * Notice: Undefined variable: term in taxonomy_title_taxonomy_term_update() (line 42 of /home/pamelapotter/public_html/sites/all/modules/taxonomy_title/taxonomy_title.module).
    * Notice: Trying to get property of non-object in taxonomy_title_taxonomy_term_update() (line 42 of /home/pamelapotter/public_html/sites/all/modules/taxonomy_title/taxonomy_title.module).
    * Notice: Undefined variable: term in taxonomy_title_taxonomy_term_update() (line 43 of /home/pamelapotter/public_html/sites/all/modules/taxonomy_title/taxonomy_title.module).
    * Notice: Trying to get property of non-object in taxonomy_title_taxonomy_term_update() (line 43 of /home/pamelapotter/public_html/sites/all/modules/taxonomy_title/taxonomy_title.module).
    * Notice: Undefined variable: term in taxonomy_title_taxonomy_term_update() (line 43 of /home/pamelapotter/public_html/sites/all/modules/taxonomy_title/taxonomy_title.module).
    * Notice: Trying to get property of non-object in taxonomy_title_taxonomy_term_update() (line 43 of /home/pamelapotter/public_html/sites/all/modules/taxonomy_title/taxonomy_title.module).

Any ideas?

CommentFileSizeAuthor
#2 taxonomy_title.zip8.67 KBownage
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpotter’s picture

Here is a quick fix:

In taxonomy_title.module, both the "taxonomy_title_taxonomy_term_update" and "hook_taxonomy_term_insert" functions are simply missing the $term argument as per the API. Not sure how this every worked for anybody using the D7 version. So here is the correct code:

/**
 * Implements hook_taxonomy_term_update().
 */
function taxonomy_title_taxonomy_term_update($term) {
  _taxonomy_title_delete_title($term->tid);
  _taxonomy_title_insert_title($term->tid, $term->taxonomy_title);
}

/**
 * Implements hook_taxonomy_term_insert($term).
 */
function taxonomy_title_taxonomy_term_insert($term) {
  _taxonomy_title_insert_title($term->tid, $term->taxonomy_title);
}

Simple fix.

ownage’s picture

FileSize
8.67 KB

Perfect fix, mpotter!

Attached is the fixed version (full module) to save anyone time.

Great module btw; it's the only solution to getting the correct page title with taxonomy terms if your parent menu link is linked to the first child. Otherwise it would normally give the page title of the parent. Works like a charm!

jenlampton’s picture

Assigned: Unassigned » jenlampton

I don't have any D7 sites using this in production yet (maybe it didn't every work for anyone?), so thank you for testing :) I'll get to these fixes shortly.

ParisLiakos’s picture

Yes.Actually the $term argument is missing only from the taxonomy_title_taxonomy_term_update()

I couldnt create a patch cause there is no 7.x version in git:)
But its an easy fix yes

jenlampton’s picture

Status: Active » Closed (fixed)

Git branch created (fo realz this time) and fix committed.
Thanks,
Jen