Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is there anyway to use taxonomy terms to cause an action to take place?
My goal is to have an individual notified when a forum topic has been created within a specific forum or a comment has been placed within this specific forum.
Thanks
Comment | File | Size | Author |
---|---|---|---|
#152 | rules-condition_has_term-343403-152.patch | 1.42 KB | eelkeblok |
#149 | rules_condition_content_has_term-343403-149.patch | 1.5 KB | eelkeblok |
#145 | rules_condition_content_has_term-343403-145.patch | 1.17 KB | underq |
#122 | taxonomy.rules_.inc_.txt | 9.23 KB | Anonymous (not verified) |
#122 | taxonomy.rules_forms.inc_.txt | 7.78 KB | Anonymous (not verified) |
Comments
Comment #1
fagohnm, there are no conditions yet. I think conditions like "Content has term assigned" would make sense. patches welcome.. ;)
Comment #2
Dinis CreditAttribution: Dinis commentedI'm trying to do this too, any idea what the PHP would look like in the condition?
Comment #3
EmanueleQuinto CreditAttribution: EmanueleQuinto commentedThis patch is a plain-vanilla implementation of taxonomy conditions .
It allows you to enter a comma separated list of term (numeric tid) to check against node taxonomy terms.
It doesn't have any form validation, vocabulary selection... but it seems to work (almost on our staging server).
Comment #4
EmanueleQuinto CreditAttribution: EmanueleQuinto commentedComment #5
Dinis CreditAttribution: Dinis commentedThis looks perfect, I'll pop it onto dev tomorrow and test it :)
Comment #6
amitaibu+ $info['taxonomy_rules_has_tid'] = array(
I except this function to return a bolean - if content has a term or not.
You should probably add another function 'taxonomy_rules_condition_content_has_specific_term'. That condition can take a 'taxonomy_term' argument, and will check a content has that specific term.
Comment #7
fagoAlso be sure to obey the drupal coding standards and remove any codelines commented out.
Comment #8
fearlsgroove CreditAttribution: fearlsgroove commentedThis patch includes has term and has term in vocab conditions, along with some other stuff in like creating user roles. It also adds text fields supporting input processing for all vocab related functions and some other updates.
This definitely needs cleaning and work, and possibly even to be split amonst several patches since it goes beyond the scope of this issue. Think of this more like a brain dump. Also patch was created as a diff from my svn repo, which imported and tracks the 1.x-dev cvs repo, but had #456328: Taxonomy actions: Add/Delete term committed already, so it'll probably hunk a bit. When I have time to come back to this (a week or so) I'll clean up and split it out into separate patches if no one else has picked it up.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedHi all,
This patch looks promising, what would I need to change to apply EmanueleQuinto's - May 11, 2009 - 07:34 patch for the taxonomy terms?
Edit:
Done, very nice work.
Comment #10
mitchell CreditAttribution: mitchell commentedNot trying to stop development here, but since this depends on #456328: Taxonomy actions: Add/Delete term, marking as postponed.
Comment #11
jbeall CreditAttribution: jbeall commentedSubscribing, I would like to be able to define a condition that checks to see if the content has been tagged with a term that is in a specific set of terms. For instance, to say "this condition is met if the content has been tagged with the terms blue, yellow, or green in the 'colors' vocabulary."
-Josh
Comment #12
jbeall CreditAttribution: jbeall commentedCould you elaborate why this depends on #456328: Taxonomy actions: Add/Delete term? That is the bug for modifying (add/delete) terms, but this issue is for inspecting the value of a term. It doesn't seem like we'd need to have a rule that adds or deletes terms before we would be able to inspect the value of terms on the node... ???
Comment #13
jvieille CreditAttribution: jvieille commentedI would need this feature.
When could it be committed?
Comment #14
klausiSetting back to needs work.
Comment #15
klausiwhoops.
Comment #16
TravisCarden CreditAttribution: TravisCarden commented+subscribe
Comment #17
rhodebump CreditAttribution: rhodebump commented+subscribe
Comment #18
catorghans CreditAttribution: catorghans commentedThis request makes sense to me. Or I should replace the taxonomy term with a cck field.
Comment #19
jvieille CreditAttribution: jvieille commentedAny progress on that?
#8 from fearlsgroove was very exciting.
Starting by our deadly missing term condition?
Comment #20
fagoPatch still needs a clean-up.
Comment #21
my-family CreditAttribution: my-family commentedNice idea, I would appreciate this feature too. Subscribing.
Comment #22
Bilmar CreditAttribution: Bilmar commentedsubscribing
Comment #23
Agileware CreditAttribution: Agileware commentedSubscribing. But working around this one for now.
Comment #24
robby.smith CreditAttribution: robby.smith commented+1 subscribing
Comment #25
Sylvain_G CreditAttribution: Sylvain_G commented+1 subscribing
Comment #26
mitchell CreditAttribution: mitchell commentedComment #27
Mindy CreditAttribution: Mindy commentedThis would be really powerful. I'm looking forward to seeing it happen. Is this a duplicate of http://drupal.org/node/490898?
Comment #28
kloewer CreditAttribution: kloewer commentedApplyed Patch #8 and can assign Rule to "Content has term in vocab assigned"
But get error Message:
Unable to find "condition" of name "taxonomy_rules_has_vocab" with the label "Content has term in vocab assigned". Perhaps the according module has been deactivated.
Comment #29
SlayJay CreditAttribution: SlayJay commentedAny update on this? This is a deal breaker for my website that I assumed wouldn't be an issue.
I need a way to "trigger" an action based on when someone posts content into a specific forum. Since Advanced Forums uses taxonomy to decide what forum content is in, I've hit a wall without this.
The patch in #8 is producing the same error from post #28 for me.
Does anyone have a work around, or another way of handling this with other modules?
/begs
Comment #30
my-family CreditAttribution: my-family commented#29: For the time being, I use Content Taxonomy fields for this purpose. However, (I don't know why) it works for me only if I specify the condition with PHP (execute custom PHP code), e.g.: return $node->field_section_taxonomy[0]['value']=='5'; (I don't know if Content Taxonomy could be used in Advanced Forum...)
... Anyway, I would appreciate "built-in" conditions for taxonomy terms in Rules very much.
Comment #31
nassimo3 CreditAttribution: nassimo3 commentedSubscribe...
Comment #32
rconstantine CreditAttribution: rconstantine commentedA hack I use for content_taxonomy is this:
You can see I also use it for optionwidgets' checkboxes where I want the rule to fire if at least one is checked. Note that for taxonomy, this also fires if at least one term is present. If you want ALL terms present, or in the case of checkboxes, ALL items selected, then I'd say we need a button added to the admin of the rule creation to select between ONE or ALL, then handle that here. But I think in most cases, we want to allow more than one value in these fields, but react to one of them as I have done here.
Comment #33
SlayJay CreditAttribution: SlayJay commented#32
Your patch seems to work fine (as in, the condition shows up and appears to be working) but I'm having an issue populating the content taxonomy field with the current node's taxonomy.
for example:
Every forum topic content has a taxonomy term of it's parent forum container. If a forum topic is under the "Applications" parent, then it has a taxonomy of "Applications" from the "forum" vocab.
I assumed that content taxonomy would be a CCK field that showed all of the nodes current taxonomy, so setting a rule of "If content_taxonomy field == "Applications" then do something" would be simple... but it seems thats not how content_taxonomy functions.
Any suggestions? Basically I'm trying to get events to fire after forum posts in certain forums are made.
Comment #34
SlayJay CreditAttribution: SlayJay commentedI was able to get the effect I needed (trigger if content has one specific taxonomy term) by using the following code as a custom php code trigger. I can confirm this works with advanced forums on drupal 6.
someone more familiar with rules may be able to make a patch out of this. Hope it helps someone!
Comment #35
EmanueleQuinto CreditAttribution: EmanueleQuinto commentedThe attached patch is simply an updated version of #3.
Minimal UI and minimal code: you must enter a comma separated list of (numeric) tids.
I didn't implement the solution proposed in #8 because UI isn't IMHO clear: you can use the dropdown (and select only one term) OR the textarea (and put multiple tids). I guess would be better to create a checkboxes fieldset for this or implement an autocomplete (like tags) so would be possible to use term name (much fancier for users).
Comment #36
leon85321 CreditAttribution: leon85321 commentedhi, thx for the patch, any progress on select list/checkbox instead of inputing the term id?
Comment #37
YK85 CreditAttribution: YK85 commentedneeds review for #35?
Comment #39
aleighs CreditAttribution: aleighs commentedI am not able to get the patch in #35 to work.
I can confirm that the rule is functioning without the "taxonomy condition" and that something in its place like "and sticky" is working. Here's the scenario I tested it in. When content is saved > if content type is "X" > AND has term id of "123" then modify node terms.
However, it is working on the second save of the node when I have the argument configuration set to "unchanged content", but not on the first save of the node.
Comment #40
aleighs CreditAttribution: aleighs commentedThis issue is a duplicate of http://drupal.org/node/49089. The patch there is working for me.
Comment #41
klausiMarking this as duplicate of #490898: Condition: does term exist?
Comment #42
Sepero CreditAttribution: Sepero commented#8: rules-many-additions.patch queued for re-testing.
Comment #43
klausiComment #44
fastcat.org CreditAttribution: fastcat.org commentedUnless I'm missing something big, this and http://drupal.org/node/49089 are not duplicates.
This patch adds a condition to check that a node has a term assigned. It checks the state of a node.
http://drupal.org/node/49089 adds a check that a named term exists. It checks the state of a vocabulary tree. The patch includes a comment saying that it checks if a term is set on a node, but that does not appear to be what the patch implements at all.
Comment #45
ded CreditAttribution: ded commentedI agree this is not a duplicate of #490898: Conditions on terms.
Comment #46
AlexisWilke CreditAttribution: AlexisWilke commentedHi guys,
This is definitively not a duplicate of #490898: Condition: does term exist? as it checks whether a node has a certain set of terms assigned.
Note that I'd have two requests here:
1) the explode() works but if I write 3, 5, 6, 7 ... with spaces, then " 5" won't match 5 in the array intersect.
2) if we have such a test, adding one flag would allow us to test that ALL the terms were selected in the node (i.e. count($rule_tid_array) = count(intersect_array([...])) is TRUE.)
And a side note, the 'help' is quite wrong:
since this test is of terms assigned to a node and not vocabulary (which wouldn't be as useful... and since each term has a unique tid, it doesn't matter too much whether a specific vocabulary is attached to a node. If the term exists, you can infer that the taxonomy is attached.)
Thank you.
Alexis Wilke
Comment #47
AlexisWilke CreditAttribution: AlexisWilke commentedComment #48
westie CreditAttribution: westie commented+1 subscribing
Comment #49
Katrina B CreditAttribution: Katrina B commentedI had subscribed to another issue, thinking it might be related to the problem I'm trying to solve -- but this issue thread might be closer to what I'm looking for, as I need to be able to create this kind of Rule: "If node has (this term) attached to it, then (do this)."
The difficulty I'm facing is that I'm not allowed to patch modules, due to restrictions at my job, so I'm hoping this feature will eventually be added to Rules.
Comment #50
tribsel CreditAttribution: tribsel commentedsame problem as in #28
Comment #51
tekken CreditAttribution: tekken commentedsubscribing
Comment #52
tekken CreditAttribution: tekken commented#8: rules-many-additions.patch queued for re-testing.
Comment #53
Encarte CreditAttribution: Encarte commentedsubscribe
Comment #54
Anonymous (not verified) CreditAttribution: Anonymous commentedsubscribing
Comment #55
ArtusamakLet's focus on small steps, here is a patch exposing the condition "A node has specific term(s)", you can select the vocabulary where to select the term (or multiple terms), to narrow the list of term displayed and then you just have to pick the terms you want to match as a condition.
Please review. [Do not test this patch but the one in the comment below. Thanks]
Comment #56
ArtusamakFixing a typo.
Comment #57
HazaSeems only to works for one term.
Exemple rules : Display a message when a node is saved with a taxonomy term attached.
One vocabulary, 3 terms ID (t1, t2, t3)
Test 1 :
rules : one condition > one term attached t1
New content : t1 is attached
Result : ok
Test 2 :
rules : one condition > NEGATE one term attached t1
New content : t1 is not attached
Result : ok
Test 3 :
rules : one condition > NEGATE one term attached t1
New content : t2 is attached
Result : ok
Test 4 :
rules : two condition > term attached t1 and t2
New content : t1 & t2 are attached
Result : nok
As long as there is only one term, that work very well.
If the conditions is about two or more term, it no longer work.
Also, if checked negate checkbox, then save the first step of the form, checkbox is no longer checked.
Comment #58
AlexisWilke CreditAttribution: AlexisWilke commentedI think that the inner foreach() loop in #56 is wrong.
I would imagine that the $match = TRUE; should be followed by a break statement. And the $match = FALSE should be set before the loop. Something like this:
Thank you.
Alexis
Comment #59
anrikun CreditAttribution: anrikun commentedSubscribing.
Comment #60
hillaryneaf CreditAttribution: hillaryneaf commentedsubscribing
Comment #61
anrikun CreditAttribution: anrikun commentedHere is a new patch.
It is different from the previous one: Evaluates to TRUE, if the given content has one of the selected terms.
I have changed this to mimic the way other built-in Rules conditions work.
Because of the way free tagging terms are saved, free tagging terms are not currently fully supported.
Comment #62
fagoMissing trailing point ;)
From looking at the code, the patch looks fine. As this is already possible in d7, it's fine adding it to d6 too. However, as I'm busy with d7 development I'd like to get some testers/reviews for that before we commit it.
>Because of the way free tagging terms are saved, free tagging terms are not currently fully supported.
That's fine.
I'm a bit worried about loading *all* terms into a big vocabulary. Is this feasible to do on sites with big big vocabularies? Any testers? :)
Also, term names aren't unique so it might be a good idea to append (Term id: X) to the name in the select, so users are able to distinguish multiple terms having the same name.
Comment #63
anrikun CreditAttribution: anrikun commented@fago: I wanted to have a look at the way it's done in D7 but I can't find it. Can you point me which file to open?
Comment #64
AlexisWilke CreditAttribution: AlexisWilke commentedYes, the select needs to be a text field a la Tags where people can type the term(s) and have an auto-complete. Anything over 100 terms and you'll blow up the browser!
Thank you.
Alexis Wilke
Comment #65
anrikun CreditAttribution: anrikun commentedLet's revert to "Need work" then.
But I'm not sure if it is possible to do it like tags: term names are not unique and there might be several terms sharing the same name across all vocabularies.
Comment #66
ArtusamakBecause this feature is needed and has been opened 2 years ago, we can start with the actual patch and then open a new issue to scale better. What do you think about that?
Comment #67
anrikun CreditAttribution: anrikun commented@Artusamak: I think so.
But I would like to have a look at this in D7 (See #62, #63). But is it really in D7 :-|?
Comment #68
anrikun CreditAttribution: anrikun commentedLet's wait for some more reviews...
Comment #69
anrikun CreditAttribution: anrikun commentedHere is an updated patch:
- @fago: added the missing trailing point ;-)
- added a call to
check_plain()
on$vocabulary->name
Comment #70
AlexisWilke CreditAttribution: AlexisWilke commentedI think that the auto-complete will work by just and simply adding the '#autocomplete_path' as shown below. This is assuming we have a specific vocabulary (i.e. $vid).
Thank you.
Alexis Wilke
Comment #71
ArtusamakWhy is the vocabulary configuration has been removed? I think it really makes sense to narrow the list of terms loaded.
I'm not in favour of the autocomplete option which may only appropriated on large vocabularies but most of the time you just want to pick terms from a short list of terms. I think it's less easy to use when you want several terms.
Comment #72
anrikun CreditAttribution: anrikun commentedThe patch I have submitted is just a different one with a different approach. It allows to select terms across different vocabularies.
I agree that we have to find a way to narrow down the list of terms loaded, but we cannot restrict term selection to only one vocabulary.
Letting this as Needs review won't hurt meanwhile as it is just a "Needs UI improvement" problem.
Comment #73
skobe CreditAttribution: skobe commentedsubscribing
Comment #74
mashizhao CreditAttribution: mashizhao commented#69's patch works beautifully. Thanks.
Comment #75
crifi CreditAttribution: crifi commentedYeah, patch #69 works perfectly.
Comment #76
crifi CreditAttribution: crifi commentedSorry, I must revoke this status. If you're using the "tags" setting of the vocabulary ("Terms are created by users when submitting posts by typing a comma separated list."), the condition rules_condition_content_has_term() always fails, since $node->taxonomy does not contain an array of taxonomy IDs.
Comment #77
anrikun CreditAttribution: anrikun commented@crifi:
As stated at #61: "Because of the way free tagging terms are saved, free tagging terms are not currently fully supported."
At #62, fago answered that this is fine.
Comment #78
crifi CreditAttribution: crifi commentedThe minimum is to insert a warning message or alter the vocabulary form. The tag vocabulary is a drupal core feature and hence until a consideration, this feature here has a bug. In my opinion features with new bugs shouldn't be committed and "needs work".
Comment #79
anrikun CreditAttribution: anrikun commentedWell it is not a bug but something that is not supported yet.
I agree that a notice should be displayed to user to inform him about this.
Let's revert this back to "needs work" if you prefer.
Comment #80
rfsbsbWhere do you guys think this notice should be shown? I can create the patch with that.
Comment #81
anrikun CreditAttribution: anrikun commentedOn the rule's configuration form I guess.
See
function rules_condition_content_has_term_form()
Comment #82
rfsbsbI was thinking that should be better if instead just show a notice, would be better to not allow users use tags vocabulary hiding the options and showing a warning about it.
Another option is to make a small change in
rules_condition_content_has_term
to detect if it is tags and do the validation...I don't know what is better... what do you think?
Comment #83
AlexisWilke CreditAttribution: AlexisWilke commentedThe best would be to support free tagging... 8-)
Otherwise, it's nice to have a notice when you create the rule, but then you can go to the taxonomy and change the vocabulary from not being free tagging to free tagging and it breaks anyway!
Thank you.
Alexis Wilke
Comment #84
rfsbsbI took #69 patch and made a small modification to accept free tagging.
I haven't added any message to warn the user. Do you think it should have any kind of warning? If so, any suggestion?
Comment #85
anrikun CreditAttribution: anrikun commented@rfsbsb:
If your patch adds support for free tagging (it does right?), there is no need for any warning.
Let's mark it as needs review.
Comment #86
rfsbsb@anrikun yes it adds support to free tagging.
Good. I appreciate if someone could test it too.
Comment #87
crifi CreditAttribution: crifi commentedThanks for the new patch, rfsbsb. Adding the free tag feature is the best solution. I will review the patch as soon as possible with all possible test cases (free tag yes/no, more than one tag in vocabulary, more than one tag in condition,...).
Comment #88
crifi CreditAttribution: crifi commentedI've no problems found. The patch works here. My attached one only changes some typos and coding standards.
Comment #89
anrikun CreditAttribution: anrikun commentedNice! I had noticed these typos and coding standards problems too.
If the patch works and code is clean, I guess we can RTBC it.
Comment #90
ArtusamakThe code is not clean yet, comments must start with a capital letter and finish with a point.
Otherwise it looks good.
Comment #91
fagoI don't think the comma is needed here.
Start capitalized and end with a trailing point.
However, this comment really isn't necessary. Comments should describe what is not obvious.
Better builds the array $tids by using $tids[$tid] = TRUE or = $tid. So you can check using isset($tids[$tid]) what is faster. (in_array() has to loop over the array)
Comment #92
rfsbsbI'm sending a new patch. It's a merge of patch in #84 and #88 with @Artusamak and @fago suggestions/corrections.
I hope this one is okay :-)
Comment #93
crifi CreditAttribution: crifi commentedIn my opinion we should only use one of the array element count functions: count() or sizeof().
The PHP documentation says: sizeof() is an alias of count()
Comment #94
rfsbsbMy bad. I've forgot to apply this change that was suggested in 88.
the patch including this change.
Comment #95
rfsbsbHi guys. Does have anyone tested it? Is it RTBC?
Comment #96
trillex CreditAttribution: trillex commentedHaving looked at this function in Drupal 7, I must also ask, where is it? :)
The content has term condition, that is.
Comment #97
crifi CreditAttribution: crifi commentedI have done some black-box-tests on rules_condition_content_has_term() which is the main critical function. All tests are successful. I have all other functions reviewed and functionality is tested. So this is RTBC now!
Comment #98
underq CreditAttribution: underq commentedThx for this last patch but i was some error with foreach & empty taxonomy.
I did a patch
Comment #100
underq CreditAttribution: underq commentedUnix ... :D
Comment #101
rfsbsbHi underq can you explain which conditions the patch in #94 can cause the errors you mentioned? I tried some stuff and couldn't get any error.
Comment #102
anrikun CreditAttribution: anrikun commented#98: rules_condition_content_has_term.patch queued for re-testing.
Comment #103
underq CreditAttribution: underq commentedHi rfsbsb,
I was 2 taxonomy vocabulary on a content type and i was an array like that in $taxonomy
Comment #104
rfsbsbThanks @underq!
Indeed there was this little problem. While checking your patch I've found another bug in my implementation to allow tags and I've fixed it in this patch.
Comment #105
crifi CreditAttribution: crifi commentedInteresting update. For my advanced education: How can I have an empty taxonomy array value (#103)? ;-) Thanks for pointing this out!
Comment #106
rfsbsbHi @crifi in fact the array @underq pointed out isn't accurate.
The array you got when using two vocabularies in a node and filling only one you got a array like the one below:
Comment #107
mpavankumar CreditAttribution: mpavankumar commentedafter adding this patch i can see a new condition 'Content has term' in Rules, but i can not see terms listing of any vocabulary for selection. I think i am missing something, but could not figure it out. Can anyone give some pointers.
Comment #108
rfsbsbHi mpavankumar indeed there was an error in last patch.
I think this one solve everything now.
Comment #109
underq CreditAttribution: underq commentedHi, I have some error with this patch
warning: Illegal offset type in /sites/all/modules/rules/rules/modules/taxonomy.rules.inc on line 335.
I solved with this one
Comment #111
fagoYou need to roll patches with -p1.
Patch basically looks good to me, though I've not tested it.
Comment #112
rfsbsbHi guys, I've took underq patch and fixed in a different manner.
I've done a lot of tests and I think now it's ok.
Tests are welcome.
Comment #113
rfsbsbDid anybody tested it? Does anybody confirm if it works?
Comment #114
underq CreditAttribution: underq commentedI will test today and try to do a simple test if I have some courage
Comment #115
underq CreditAttribution: underq commentedI have do some test (but it is only the second time that I create test code ;) )
and some change for passe this test
Comment #117
underq CreditAttribution: underq commentedHi rfsbsb,
I was stupid when I created this patch. I tested your's today and it works nicely with me ;)
Comment #118
rfsbsbThanks for testing.
Can anyone else test it and mark the patch as RTBC?
Comment #119
vlooivlerke CreditAttribution: vlooivlerke commentedThanks #112 works
Thanks again rfsbsb
This enables me to do some amazing stuff.
Comment #120
rfsbsbHi vlooivlerke, it's a pleasure :-)
If you think it's ok, would you please mark it as rtbc?
Thanks guys
Comment #121
vlooivlerke CreditAttribution: vlooivlerke commentedI tested it with a small rule
I am building extensive rules on a production site this week and will then set it to rtbc
Thanks again
Comment #122
Anonymous (not verified) CreditAttribution: Anonymous commentedI am very thankful I found this thread. I too needed to generate a system email when someone created a node with a certain taxonomy term selected.
I applied the patch above at http://drupal.org/node/343403#comment-5236684 but I am still not able to get this to work. I believe my inc files were patched correctly but could someone take a look please if you have a minute? I am not sure why this isn't working on my site. I must be missing something. I tested a general rule for sending an email and it worked but not with taxonomy terms.
My rule is:
Event: after saving new content
Conditions: if content is published
and
if content type is News and Events
and
if content has term Student Employment
Action: send mail to arbitrary address
Thanks so much!
Comment #123
perlgal CreditAttribution: perlgal commentedThanks #112 works
Thank you rfsbsb!
Comment #124
rfsbsbHi guys, can anyone mark it as RTBC? Is it really ok?
Comment #125
vlooivlerke CreditAttribution: vlooivlerke commentedhere is my 20c,
I would have marked this as RTBC, but for some reason this rule only works on very simple rule sets. The minute I use it in more complicated rules it fails. I love this function but I cant put my finger on where it fails. I am trying to get roles to be assigned when a term is selected.
Comment #126
anrikun CreditAttribution: anrikun commented@vlooivlerke:
Are you sure that your rule itself is not faulty here?
Maybe you could post it.
Comment #127
Encarte CreditAttribution: Encarte commented@vlooivlerke, role changing is not an easy action to configure. Are you sure you have the necessary permissions correctly set? The acting user needs to have permission to change roles. Does your rule work if you try a condition other than Content has term?
Comment #128
AlexisWilke CreditAttribution: AlexisWilke commentedEncarte,
I've set roles many times from any user (Except Anonymous) and it worked just fine. In software from Rules it doesn't check permissions as far as I know.
Thank you.
Alexis
Comment #129
kaizerking CreditAttribution: kaizerking commentedIt may be relevant to consider to include this issue TAC Lite Rules integration
if it doesn't fit here my apologies plz
EDIT:Sorry, i didn't see that the current issue here is for 6x issue,I am keeping it here for anyones reference.
the TAC Lite rules integration issue is for 7x
Comment #130
kaizerking CreditAttribution: kaizerking commentedcan this be used in D7?
I need this ureently
Comment #131
rfsbsbHi @kaizerking, this patch is for D6 only.
@vlooivlerke can you provide a more detailed revision of what you've found?
Comment #132
vlooivlerke CreditAttribution: vlooivlerke commentedI found this to work.
Tested it with various rule combinations and on live and local server.
I patched it manually, so cant comment on that
Comment #133
fagothanks, I committed the patch from #112!
For d7, things work a bit different here as terms are never generally assigned to nodes any more, but they are assigned to nodes by fields. Thus, you'll have to check per-field, which can be done with the condition "List contains item".
Comment #134
kaizerking CreditAttribution: kaizerking commented@fago, is there any help documentation on this, on "list contains item" list means which list? or where do we create a list?
My requirement is if job per template has term reference, i want to grant access to the user if he has "equal to" or "one of" term references in his/her profile2-field collection field (Work experience)- term references, it is proving very difficult for me kindly guide/help
Comment #135
hedac CreditAttribution: hedac commentedjust tried last dev.. but the condition always return FALSE... I'm creating a forum topic with a certain term and the condition has term.. with that term selected... not sure why it is not working. Maybe because the forum is inside a container.. which gives it a different taxonomy depth?
Comment #136
zvischutz CreditAttribution: zvischutz commentedHi there
It did return FALSE all the time as @hedac mentioned .
I changed the loop on bottom of rules_condition_content_has_term lines 325-338 to the following and it worked.
Best
Zvi
Comment #138
soundboy89 CreditAttribution: soundboy89 commentedWill this eventually make it to a release version of the module for D6?
Comment #140
jvieille CreditAttribution: jvieille commentedIncorrect status
Comment #141
vlooivlerke CreditAttribution: vlooivlerke commentedThis rule is expensive on the juice
My rule works like this, after updating existing content and content has term "holiday accommodation"
In the top code the content has no term selected, but look at this part:
0.14 ms Executing the rule "Content has term Holiday Accommodation" on rule set "After updating existing content"
and
0.602 ms Executing the rule "Content has term Holiday Accommodation" on rule set "After updating existing content"
Why is it doing this? It should not execute at all coz there is no term (0.931 ms Condition "Content has term" evaluated to FALSE.)
Here is the code if I select a term, but it still do some execution.
Comment #142
AlexisWilke CreditAttribution: AlexisWilke commentedIt's probably when it's loading your terms... Do you have many terms in the taxonomy you are testing with?
Alexis
Comment #143
vlooivlerke CreditAttribution: vlooivlerke commentedYes, over 300 terms in 3 tiers.
But why is it loading it, to see that there is no term selected?
Comment #144
underq CreditAttribution: underq commentedThis rules always return false in this case.
Exemple :
1 - I create a new node without term.
2 - I have a rules wich start when I save this node and execute
rules_action_taxonomy_term_assign_to_content($node, term1, $settings);
with term1.3 - I have a second rules wich start after the first one and check if node have term1
rules_condition_content_has_term($node, $settings = term1);
but this function return false.This happen when $node->taxonomy[] is a stdClass like after
rules_action_taxonomy_term_assign_to_content();
and this function check if $taxonomy is an array or an integer.Comment #145
underq CreditAttribution: underq commentedThis patch try to resolve comment #343403-144: Condition: content has term.
Reviews are welcome :)
Comment #146
soundboy89 CreditAttribution: soundboy89 commentedI applied #145 and worked like a charm. Thanks underq!
Comment #147
qasimzee CreditAttribution: qasimzee commented#145 works like a charm
Comment #148
kaizerking CreditAttribution: kaizerking commenteddoes this only works for nodes? or works for entities as well?
ex:"entity has term"
Comment #149
eelkeblokThanks for all the work on this patch. @kaizerking: This is an issue for 6.x, so not really :) A similar question about how to accomplish this in D7 was asked and answered further up (if you need more help, please ask somewhere else, this issue is strictly for making changes to the 6.x branch of this module).
I ran into the same problem, that my terms were not recognized because they showed up as objects in the taxonomy array in the node. I applied the patch from #145. Although it does appear to work, when stepping through it using XDebug I found some weird behaviour; it treats the term objects in the taxonomy array as arrays themselves (foreach-ing over the object), which results in each member variable of the object to be treated as a term in its own right. Although this means that functionally the condition will trigger when the sought term is applied, it also means the functionality is not quite correct and I think could even lead to false positives.
I'll be attaching a patch later to correct this.
Comment #150
eelkeblokWhoops. Actually attached the patch already :) The patch attached to #149 treats the check for is_object as the separate case that it is.
Comment #152
eelkeblokSorry, rolled the patch from my dev environment so the path was incorrect. This should apply correctly.
Comment #153
dblais CreditAttribution: dblais commentedIt's work now. Thank you! . Before, has_term was never TRUE because $vocab was a object, so tid was always empty.
Can you integrate it the next relase soon?
Someone else have this issue:
https://drupal.org/node/1891716
Comment #154
eelkeblokDoes this qualify as RTBC? :)
Comment #155
fagoPatch violates coding standard. Also, please do not re-open fixed issues - instead create a new one and link it here to inform potentially interested people. Setting back to the status of the original issue - fixed.
Comment #156
eelkeblokWow, that was way back in comment #141, I wasn't even aware this was a re-opened issue.