When an user role changes and becomes "writer", there is a rule that creates a new entity type "taxonomy term" name "user name" and assign it to vocabulary "writers". This works.

Now, the user can create stories. When this user creates stories, this content type should be assigned to term "author name" to vocabulary writers.

It is possible without using PHP, simply adding some actions?

  • 1
    User roles don't change. Users can eventually get new roles. Apart that, why would you assign a taxonomy term indicating the node author when nodes already have a reference to the users who created them? – kiamlaluno Dec 15 '19 at 20:39

If it was me, I would add a term reference field to user, then when the user becomes "writer" and the related term was created I just added that term to user,

Then using rules, when the user creates a story, I would need to attach term to node, likely I have the term Id attached to user so it could be simply attached to node.

in this way no php code is needed.


yes, it's possible, use rules conditional module, this module let you to add conditions on acctions area, add same field 'taxonomy-term' on node-story content type, in your rule, reacting on 'after saving node of tpye story', in actions area do: fetch entity by id, pull user-author, then add a conditional, inside there add an IF: entity has field, your fetched user field 'taxonomy term', now you have the user-term in your rule, next, add an action inside your IF, set a data value, your new story-node field-term equals your user-term field. done.

Your rule will look something like: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.