RulesEngine

RulesEngine is a wordpress plugin used for defining rules for wordpress components such as Pages, Posts, Categories, Themes, Widgets and URL Redirection. RulesEngine follows “define once and use in many ways” strategy, which enables admin to define the logical rule at once by using rule criteria such as User Role, User Profile, Mobile Device, Tablet, Geo location, Date and Time, Request URL, Browser Type etc and uses them in defining the child rules like Page, Post, Category, Theme, Widget and URL Redirection. RulesEngine consists of a parent rule called a Logical Rule and 6 child rules. Following are the list of child rules:

  1. Page Rules
  2. Post Rules
  3. Category Rules
  4. Widget Rules
  5. Theme Rules
  6. Rules for URL Redirection

A logical rule is defined by 9 different 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 conditions like equals, not equal, greater than etc.

In future releases many more rules are planned.

Click here to view the complete list of categories and subcategories.

Features:

  • Define simple rule like role as Administrator.
  • Define complex rule using logical “AND” “OR” and “Brackets” . (e.g: like role is Administrator and Country is USA and Month is January etc, see below sreenshots.) See Logical rule section for more info.
  • Hide menus based on logical rule more info.
  • Hide, Soft Hide, show, append or replace content for Pages based on the logical rule.  more info.
  • Hide, show, append or replace content for Posts based on the logical rule.  more info.
  • Show or Hide Categories based on the logical rule more info.
  • Show or Hide Widgets based on the logical rule more info.
  • Show a different Themes for users, roles or on a specific day or county etc .. based on the logical rule more info.
  • Redirect to a different Page or Site based on the logical rule more info.
  • Add dynamic content to Pages and Posts top.
  • Add dynamic images to Pages and Posts.
  • Generate dynamic Shortcode for Page and Post rules, so that we can add dynamic content/image at any desired location.
  • Define rules for Third-Pary Shortcode (New in RulesEngine v 1.1).
  • Define a dynamic hook using Rules Engine which will be called by plugin once the rule is satisfied.
  • Access the status of the logical rule using the utility method in the code. RulesEngine::is_rule_valid(“Rule Name”);
  • User Friendly easy-to-use Ajax interface.
  • Reduces development effort and easy to maintain.
  • Activate or Deactivate rule using the admin UI.
  • Simple to upgrade.

We can define simple and complex rules using rule engines. Below is an example of simple rule created using User Role Criteria. Click on the image to view details.

Simple_Rule

Using RulesEngine we can create more complex rule with a combination different types of rule criteria (User Role, Geo location, Mobile Device, Page etc) using logical “AND” and “OR” operators and segregate them using parenthesis. Click on the image to view details.


Important use cases using RuleEngine:

  • Hide Pages/Posts/Categories/Widgets by User Role: Show or hide pages, posts, categories, widgets for a specific user role.
  • Hide Pages/Categories/Widgets from Guest User : Hide some pages, posts, categories, widgets from Guest user.
  • Simple Ad Manager: Page or Post rule defined with images will act like a simple Ad manager. Using this rule we can use an Ad image with a logical rule defined with Date/Page/Geographic location etc to show image Ad on respective Pages or Posts.
  • Pages by Date and Time:  Show special  pages like “New Year”  or “Christmas”  or “Year End Sales” discounts page and make them available for only few days or months.
  • Pages by Geo Location (Continent, Country, City and Region):   Hide or append information for request which are coming from a specific geographic location country or continent.
  • Restricted Pages:  These page are available only authenticated users, guest users will be redirected to login page.
  •  Show Greetings or Important messages:  Using RulesEngine we can show greetings or important message such as new year wishes or festival wishes or System downtime.
  • Themes by Geo Location (Continent, Country, City and Region):   Using RuleEngine, we can show a different Theme for a specific geographic location country or continent then define a logical rule using “Geo Location” Criteria. This is useful for theme is very useful for Middle East countries.
  • Themes by Date and Time: Using RuleEngine, we can show a different Theme on special themes on  “New Year” or “Christmas” etc…  and these theme should be available for only few days or months, in such cases define a Logical rule using “Date and Time” criteria. You can use Date, Time, Day of Week and Month sub criteria to further refine the rule.
  • Theme for Guest User :  Show a fancy theme for a  Guest user(Not logged in User) and default theme for logged in user.
  • Themes by Device Type: Show a light weight theme for Mobile and Tablet devices and default theme for desktop users.
  • Themes by User Role: Show a different theme for a specific role.
  • Redirect for Geo location (Continent, Country, City and Region): : Redirect based on the request country, city and Region.
  • Redirect for Mobile Sites: Redirect to mobile sites for requests coming from mobile or tablet devices.
  • Redirect Secure Pages : We can configure Pages as Secure pages and these pages content will be shown only  for authenticated users. Guest users will be redirected to Login Page upon clicking on Secure Pages.

 

Please Note: This is not the final documentation for Rule Engine, Plugin author is going to update the documentation on regular basis. Please send your comments to rules4wp@gmail.com.