Hi,

I want to use the rule module to send notifications by mail to users of my website. I want to create a rule with this condition :

IF the body of the node is too long (>1000 characters) -> Send this email (without node body)

IF the body of the node is not too long (>1000 characters) -> Send another type of email (with node body content).

Is it possible to make that ? If it is can you help me ?

Thanks for your help !

Comments

vstmusic’s picture

Sorry, second condition is : (<1000 characters) ... of course

vstmusic’s picture

is there no solution to create this 'counter node string' condition ?

mitchell’s picture

Title: How create a rule that count the numbers of characters in the body of a node ? » Condition: count the number of characters
Version: 6.x-1.2 » 6.x-1.x-dev
Component: Features integration » Rules Engine

This condition does not currently exist, though it would be a nice addition to rules. If you write it, I hope you would also contribute it back.

The handbook and rules codebase would be helpful, and the guide for creating patches is a great resource all around. It would probably use strlen or count-chars.

vstmusic’s picture

arg. I don't know the php language.

mitchell’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev

New feature requests are going into 7.x first.

mitchell’s picture

Status: Active » Postponed
Issue tags: +data

Tagging 'data'. Setting as inactive.

tr’s picture

Version: 7.x-2.x-dev » 8.x-3.x-dev
Component: Rules Engine » Rules Core
Issue summary: View changes
Issue tags: -data

New features should go into 8.x-3.first, at this point, then be backported to 7.x-2.x if there is some demand.

tr’s picture

Status: Postponed » Closed (won't fix)

The D8 Rules Essentials module includes a count filter that you can use in the Rules "Data comparison" condition to test the length of the node body, among other things. Use it like this: {{ node.body.value | count }}

Because there has been no community interest in this since the original post, and because the feature is available in a contributed module for Rules, I am marking this as "Won't fix".

tr’s picture

Issue tags: +D8RE

Tagging issues that will be fixed by code moved from D8RE.