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.
Hi there,
In #1255280: Document alternative to Notifications integration, you mentioned that it is possible to create a Rule to send an email to the sender of a status when someone comments on the status – but that in order to do so, it is "probably necessary to load the status object to get access to the sender's email address."
Can you explain how you are loading the status object? I see the Action to "Load a status", but no way to get a data selector I can use to get the ID to pass to that Action.
Comment | File | Size | Author |
---|---|---|---|
#13 | rules-integration-issue-1693620-13.patch | 3.13 KB | mathankumarc |
#12 | rules-integration-issue-1693620-12.patch | 2.31 KB | mathankumarc |
#7 | statuses-rules-load-comment-1693620-7.patch | 1.4 KB | IceCreamYou |
Comments
Comment #1
mrwhizkid CreditAttribution: mrwhizkid commentedI've been trying to figure this out too:
When you use the action 'load a status id', these are the only data selectors available:
SELECTOR LABEL DESCRIPTION
site:current-user:uid User ID The unique ID of the user account.
site:current-user:roles: User roles The roles of the user.
site:current-user:status Status Whether the user is active or blocked.
Not sure how to get the status ID.
Comment #2
IceCreamYou CreditAttribution: IceCreamYou commentedThere should be tokens for the comment being created, one of which should be the status ID. If tokens for the comment being created are not there, that is probably a bug. However, I can only respond to bug reports against the development build until there is a stable release.
Comment #3
mrwhizkid CreditAttribution: mrwhizkid commentedIs it OK then for me to change this status to the development build? That is actually what I am using now and I am having the same problem.
No tokens for the status ID when trying to load a status from an event of saving a new comment.
Comment #4
venutip CreditAttribution: venutip commentedA closer look reveals that I am using the dev version as well. Hard to tell since there's no version number in the .info file.
Comment #5
IceCreamYou CreditAttribution: IceCreamYou commentedOf course
The only reason you wouldn't have a version number in the .info file is if you pulled the files from git. The drupal.org packaging script puts a block like this into every packaged release:
The version should also appear at admin/modules.
Comment #6
venutip CreditAttribution: venutip commentedYeah, got it from git so no version number in .info or at /modules.
Comment #7
IceCreamYou CreditAttribution: IceCreamYou commentedThe problem here seems to be that Statuses offers a "Load a status" action, but Rules now expects you to use its "Add a variable" action instead. Statuses aren't currently available as a type of variable to add, and the "Load a status" action doesn't have tokens available to it. It's not immediately obvious to me why there are no tokens available to the "Load a status" action, although there are some things wrong with the way the action is specified (untested patch attached).
Comment #8
craigritchie CreditAttribution: craigritchie commentedApologies -- to be clear, what does this patch do, if I apply it?
Comment #9
IceCreamYou CreditAttribution: IceCreamYou commentedMight clear up some errors, but otherwise pretty much nothing right now :)
Comment #10
IceCreamYou CreditAttribution: IceCreamYou commentedRenaming to more accurately reflect the root issue, since it is causing problems for several different Rule configurations.
Comment #11
mathankumarc CreditAttribution: mathankumarc commentedI'm started on this :)
Comment #12
mathankumarc CreditAttribution: mathankumarc commentedAh Found out the problem.
Here also the problem is statuses is not an entity, however rules considers the statuses as entity. Rules module provided additional options to implement rules on non entity.
Attached a partial patch, still its need cleanup/fixes.
Note:
Actually the rules integration is broken, there is no problem with token integration :(
To identify this one point, explored lot resources and learned many things :)
Comment #13
mathankumarc CreditAttribution: mathankumarc commentedHere is the complete patch.
Testers are welcome. Don't forget to monitor the log messages while testing.
Sample rule for sending mail to the sender of the status when someone commented on it,
Comment #14
IceCreamYou CreditAttribution: IceCreamYou commentedHaven't tested, but looks good to me -- in any case it's better than what we have now. ;) If you think this issue is basically resolved, feel free to commit and address any followup problems in separate issue(s).
Comment #15
mathankumarc CreditAttribution: mathankumarc commentedI thought waiting until someone test this and give a report.
Any volunteers?
By the way, Sorry for the very late replay, due to my health challenges unable to look into the issue queue for past 3 weeks.
Comment #16
mathankumarc CreditAttribution: mathankumarc commentedCommitted a fix to dev.
Comment #17
eidoscomHi mathankumark, you say that is commited but non updated dev version on the page. Where can we download the new dev ??
Thanks a lot and sorry for reopen the fixed issue.
Comment #18
IceCreamYou CreditAttribution: IceCreamYou commentedDev builds automatically regenerate every 12 hours. If you want it sooner than that, pull it down from git.
Comment #20
mathankumarc CreditAttribution: mathankumarc commentedComment #21
Pierre.Vriens CreditAttribution: Pierre.Vriens at In Petto commentedJust in case anybody is still interested in this topic, have a look at the Rules example included at the end of the answer to How to add missing data selector in "Create new entity" rules action?.
The rule shown there, was inspired by what's in comment #13 here. And instead of sending an eMail ("to" the "sender"-token), it does some extra Rules Actions to fetch a user entity (by property), and then uses that to target a message to that user (using the Message module ... which expects a REAL entity). A bit of Rules-hitech, but it works like a charm, starting from the
status-loaded:sender
as provided by the patch in #13.Comment #22
ugintl CreditAttribution: ugintl commentedI have tested the solution provided in #21
It works