Logical Rules

Logical rules are the heart of the rules engine, which are used for defining the rules for Page, Posts, Categories, Widgets, Themes and URL Redirection. A logical rules is defined using 9 categories like User Role, User Profile, Pages, Posts Geo location etc, 21 subcategories like Email, Registered Date, Country, Date and Time etc and with 8 like conditions like equals, not equal, greater than etc.

Please Note : This video is recorded Using RulesEngine Plugin and same feature will be applied to RulesEngine Platform too except the child rules which are shown in the video.

Many more are categories and subcategories are planned in feature release.

Logical rules also provide two important developer friendly features:

  • Define custom hook : Developers can define a method in their code and add this method in logical rules, which will be called by rules engine plugin once the rule is satisfied. Hook can be further used to develop customer features like sending email, show important messages in site.
  • Logical rule status : Access the evaluated value of the logical rule using the utility method in the code.
    RulesEngine::is_rule_valid(“Rule Name”);

See below table of categories, sub categories corresponding values for defining logical rule. We can combine the rule criteria using logical “AND” “OR” logically separate them using “BRACKETS” to define more complex rule.

Category SubCategory Value Condition
User Profile
User Id List of User Ids Equals and Not Equals
Unregistered User (Guest User) Unregistered User Equals and Not Equals
Email Id List of Email Ids Equals, Not Equals, Contains, Does not contains and Domain is
Registered Date Date Equals, Not Equals, Greater than and Less than
User Role
User Role Name List of User Roles Equals and Not Equals
Page
Page Title List of Page Titles Equals and Not Equals
Post
Post Title List of Post Titles Equals and Not Equals
Category
WordPress List of categories Equals and Not Equals
WooCommerce List of categories Equals and Not Equals
Request
URL URL (e.x : http://wiki-rulesengine.wc.lt ; http://google.com) Equals, Not Equals, Contains and Does not contains
Referral URL Referral URL (e.x : http://wiki-rulesengine.wc.lt ; http://google.com) Equals, Not Equals
Mobile Device
Mobile iPhone, Andriod Phone, BlackBerry and Windows Phone. Equals and Not Equals
Mobile Device Type Mobile, Table and Smart Phone Equals and Not Equals
Mobile Operating System IOS, Andriod and Windows Equals and Not Equals
Tablet ipad, Andriod Table, HP TouchPad and BlackBerry Tablet Equals and Not Equals
Date and Time
Date Date Equals, Not Equals, Greater than and Less than
Time Time Equals, Not Equals, Greater than and Less than
Date and Time Date and Time Equals and Not Equals
Day of Week Day of Week (Sunday, Monday etc) Equals and Not Equals
Month Months (January, February etc) Equals and Not Equals
Geo Location
Country India, USA etc (Included all countries) Equals and Not Equals
State or Region Texas, Andhra Pradesh etc (Included all States and Regions) Equals and Not Equals
City NewYork, New Delhi (Included all important cities) Equals and Not Equals
Continent Asia, Europe, Africa (Included all continents) Equals and Not Equals
Currency Rupee, Dollar, Yen (Included important currencies) Equals and Not Equals
IP Address 182.17.155.87 Equals, Not Equals, Begins with, Ends with, contains and does not contains
Browser
Browser Name Internet Explorer, Google Chrome, Firefox, Safari and Opera Equals and Not Equals
Language
Language Name English, French, Japaneese (List of all Active Languages) Equals and Not Equals