I need to load a particular term by its name. I'm using the following PHP snippet to do so (note that I am using node auto-term so the node title is my term):

  $terms = taxonomy_get_term_by_name($node->title);
  echo $terms[0]->tid;

When this didn't work I attempted something simple just as a test:

  $term = '67';
  echo $term;

This too did not work. Simply entering 67 into the form works just fine, but php evaluation does not seem to function correctly.

Comments

klausi’s picture

Component: Rules Core » Rules Engine

Have you activated the PHP filter module? (it is required for input evaluation)

eidolon night’s picture

Yes, the PHP filter is enabled and working. I'm actually using a php conditional in the same rule, and it works fine. Only this snippet isn't working.

klausi’s picture

Have you tried the dev-version of the module? There has been a commit recently, stating " #512566 patch by Amitaibu: Add eval input to "Add a new vocabulary" action", maybe this could solve your problem?

eidolon night’s picture

No, still nothing. Once again testing with the simplest statement:

  $term = '67';
  echo $term;

May be fixed in "Add a new vocabulary" but I'm using "Load a term". Maybe it's the same issue, but was never addressed in this particular action?

fago’s picture

Version: 6.x-1.0 » 6.x-1.x-dev

It should be fixed there too, but be aware that you have to delete and recreate the action so that the changes apply. Please test that.

eidolon night’s picture

Status: Active » Fixed

Worked like a charm. Thank you fago.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.